Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(panel): use class instead of style attribute to fix CSP violation #10321

Merged
merged 1 commit into from
Mar 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/panel/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ MdPanelService.prototype._wrapTemplate = function(origTemplate) {
// height and width for positioning.
return '' +
'<div class="md-panel-outer-wrapper">' +
' <div class="md-panel" style="left: -9999px;">' + template + '</div>' +
' <div class="md-panel _md-panel-offscreen">' + template + '</div>' +
'</div>';
};

Expand All @@ -1325,7 +1325,7 @@ MdPanelService.prototype._wrapTemplate = function(origTemplate) {
MdPanelService.prototype._wrapContentElement = function(contentElement) {
var wrapper = angular.element('<div class="md-panel-outer-wrapper">');

contentElement.addClass('md-panel').css('left', '-9999px');
contentElement.addClass('md-panel _md-panel-offscreen');
wrapper.append(contentElement);

return wrapper;
Expand Down Expand Up @@ -1918,8 +1918,8 @@ MdPanelRef.prototype._addStyles = function() {
// Theme the element and container.
self._setTheming();

// Remove left: -9999px and add hidden class.
self.panelEl.css('left', '');
// Remove offscreen class and add hidden class.
self.panelEl.removeClass('_md-panel-offscreen');
self.panelContainer.addClass(MD_PANEL_HIDDEN);

resolve(self);
Expand Down
4 changes: 4 additions & 0 deletions src/components/panel/panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
display: none;
}

._md-panel-offscreen {
left: -9999px;
}

._md-panel-fullscreen {
border-radius: 0;
left: 0;
Expand Down