Skip to content

Commit

Permalink
Move the <style> into the <template>
Browse files Browse the repository at this point in the history
Having the CSS outside of the template makes polymer/webcomponents? insert the style without
any scoping into the final document, which can cause style leakage.

Polymer 1.x deprecated this already:
> Prior to Polymer 1.1, the recommendation was to place <style> tags inside the <dom-module> for an element (but outside the <template>). This is still supported, but is no longer recommended.
(https://www.polymer-project.org/1.0/docs/devguide/styling)

Polymer 2.0 will no longer support this according to https://www.polymer-project.org/2.0/docs/upgrade#dom-template.

See also: Polymer/polymer#3665
See also: googlearchive/polylint#132
  • Loading branch information
ankon committed Nov 8, 2016
1 parent 7fe9792 commit b422523
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions paper-alert-dialog-icon-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
-->
<dom-module id="paper-alert-dialog-icon-header">

<style>
:host {
display: block;
text-align: center;
margin-bottom: 40px;
@apply(--paper-font-display1);
}
<template>
<style>
:host {
display: block;
text-align: center;
margin-bottom: 40px;
@apply(--paper-font-display1);
}

.icon {
color: var(--paper-green-500);
--iron-icon-width: 64px;
--iron-icon-height: 64px;
}
</style>
.icon {
color: var(--paper-green-500);
--iron-icon-width: 64px;
--iron-icon-height: 64px;
}
</style>

<template>
<iron-icon icon="[[icon]]" class="icon"></iron-icon>
<div><content></content></div>
</template>
Expand Down

0 comments on commit b422523

Please sign in to comment.