Skip to content

Commit f469129

Browse files
author
Steven Orvell
committed
Based on feedback, change module to include in custom-style and dom-module style marshaling.
1 parent 398d9f7 commit f469129

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎src/lib/custom-style.html‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
browsers without non-native Shadow DOM.
2424
* Custom properties used by Polymer's shim for cross-scope styling
2525
may be defined in an `custom-style`.
26-
* A module attribute may be specified to pull in style data from a `dom-module`
27-
matching the module attribute. By using `module`, style data
26+
* An `include` attribute may be specified to pull in style data from a
27+
`dom-module` matching the include attribute. By using `include`, style data
2828
can be shared between multiple `custom-style` elements.
2929
3030
Example:
@@ -84,13 +84,13 @@
8484
extends: 'style',
8585

8686
properties: {
87-
// module is a property so that it deserializes
87+
// include is a property so that it deserializes
8888
/**
89-
* Specify module to identify a `dom-module` containing style data which
90-
* should be used within the `custom-style`. By using `module` style data
89+
* Specify `include` to identify a `dom-module` containing style data which
90+
* should be used within the `custom-style`. By using `include` style data
9191
* may be shared between multiple different `custom-style` elements.
9292
*/
93-
module: String
93+
include: String
9494
},
9595

9696
ready: function() {
@@ -114,7 +114,7 @@
114114
styleDefaults.addStyle(e);
115115
// we may not have any textContent yet due to parser yielding
116116
// if so, wait until we do...
117-
if (e.textContent || this.module) {
117+
if (e.textContent || this.include) {
118118
this._apply();
119119
} else {
120120
var observer = new MutationObserver(function() {
@@ -136,8 +136,8 @@
136136
if (!this.__appliedElement) {
137137
e.textContent = styleUtil.resolveCss(e.textContent, e.ownerDocument);
138138
}
139-
if (this.module) {
140-
e.textContent += styleUtil.cssFromModules(this.module);
139+
if (this.include) {
140+
e.textContent += styleUtil.cssFromModules(this.include);
141141
}
142142
this._computeStyleProperties();
143143
var props = this._styleProperties;

‎src/lib/style-util.html‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
return {
1818

1919
MODULE_STYLES_SELECTOR: 'style, link[rel=import][type~=css], template',
20+
INCLUDE_ATTR: 'include',
2021

2122
toCssText: function(rules, callback, preserveProperties) {
2223
if (typeof rules === 'string') {
@@ -115,7 +116,7 @@
115116
// style elements inside dom-modules will apply to the main document
116117
// we don't want this, so we remove them here.
117118
if (e.localName === 'style') {
118-
addModule = e.getAttribute('module');
119+
addModule = e.getAttribute(this.INCLUDE_ATTR);
119120
// get style element applied to main doc via HTMLImports polyfill
120121
e = e.__appliedElement || e;
121122
e.parentNode.removeChild(e);

‎test/unit/custom-style-import.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</template>
99
</dom-module>
1010

11-
<style is="custom-style" module="shared-style">
11+
<style is="custom-style" include="shared-style">
1212
:root {
1313

1414
--import-mixin: {

‎test/unit/styling-remote-elements.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
</style>
8989
<template>
9090
<!-- style in template using module! -->
91-
<style module="remote-styles"></style>
91+
<style include="remote-styles"></style>
9292
<content select=".blank"></content>
9393
<div id="simple">simple</div>
9494
<div id="complex1" class="scoped">complex1</div>

0 commit comments

Comments
 (0)