Skip to content

Commit

Permalink
fix(panel): use class instead of style attribute
Browse files Browse the repository at this point in the history
Using a style attribute is prohibited when using strict CSP rules. Fixes angular#10085.
  • Loading branch information
Frank3K committed Jan 28, 2017
1 parent e96293a commit a267784
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/panel/panel.js
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
Expand Up @@ -10,6 +10,10 @@
display: none;
}

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

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

0 comments on commit a267784

Please sign in to comment.