diff --git a/CHANGELOG.md b/CHANGELOG.md index 6767f5aa..a842cb21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## [v2.3.1](https://github.com/Polymer/polymer/tree/v2.3.1) (2017-12-07) +- Add test that would fail with the "last style" behavior in master ([commit](https://github.com/Polymer/polymer/commit/913dfce6)) + +- Use padding-top to get correct computed style on older safari ([commit](https://github.com/Polymer/polymer/commit/b7c56173)) + +- Handle styles that are not direct children of templates correctly ([commit](https://github.com/Polymer/polymer/commit/0b1cd70a)) + +- [ci skip] update changelog again ([commit](https://github.com/Polymer/polymer/commit/2d739c75)) + ## [v2.3.0](https://github.com/Polymer/polymer/tree/v2.3.0) (2017-12-05) - [ci skip] update changelog ([commit](https://github.com/Polymer/polymer/commit/c727d35d)) diff --git a/lib/mixins/element-mixin.html b/lib/mixins/element-mixin.html index 26e1a38c..87c77db1 100644 --- a/lib/mixins/element-mixin.html +++ b/lib/mixins/element-mixin.html @@ -249,16 +249,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN function processElementStyles(klass, template, is, baseURI) { const styles = Polymer.StyleGather.stylesFromModuleImports(is).concat( Polymer.StyleGather.stylesFromTemplate(template)); - let templateStyles = template.content.querySelectorAll('style'); - let lastStyle = templateStyles[templateStyles.length-1]; + const templateStyles = template.content.querySelectorAll('style'); + // keep track of the last "concrete" style in the template we have encountered + let templateStyleIndex = 0; // ensure all gathered styles are actually in this template. for (let i=0; i < styles.length; i++) { let s = styles[i]; + let templateStyle = templateStyles[templateStyleIndex]; // if the style is not in this template, it's been "included" and - // we put a clone of it in the template. - if (s.getRootNode() != template.content) { + // we put a clone of it in the template before the style that included it + if (templateStyle !== s) { s = s.cloneNode(true); - template.content.insertBefore(s, lastStyle); + templateStyle.parentNode.insertBefore(s, templateStyle); + } else { + templateStyleIndex++; } s.textContent = klass._processStyleText(s.textContent, baseURI); } diff --git a/lib/utils/boot.html b/lib/utils/boot.html index 18625479..3ca20b3b 100644 --- a/lib/utils/boot.html +++ b/lib/utils/boot.html @@ -49,7 +49,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN }; /* eslint-enable */ - window.Polymer.version = '2.3.0'; + window.Polymer.version = '2.3.1'; /* eslint-disable no-unused-vars */ /* diff --git a/lib/utils/flattened-nodes-observer.html b/lib/utils/flattened-nodes-observer.html index f5985229..78f74127 100644 --- a/lib/utils/flattened-nodes-observer.html +++ b/lib/utils/flattened-nodes-observer.html @@ -44,6 +44,24 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * `MutationObserver` and the `` element's `slotchange` event which * are asynchronous. * + * An example: + * ```js + * class TestSelfObserve extends Polymer.Element { + * static get is() { return 'test-self-observe';} + * connectedCallback() { + * super.connectedCallback(); + * this._observer = new Polymer.FlattenedNodesObserver(this, (info) => { + * this.info = info; + * }); + * } + * disconnectedCallback() { + * super.disconnectedCallback(); + * this._observer.disconnect(); + * } + * } + * customElements.define(TestSelfObserve.is, TestSelfObserve); + * ``` + * * @memberof Polymer * @summary Class that listens for changes (additions or removals) to * "flattened nodes" on a given `node`. diff --git a/lib/utils/html-tag.html b/lib/utils/html-tag.html new file mode 100644 index 00000000..77f2429f --- /dev/null +++ b/lib/utils/html-tag.html @@ -0,0 +1,63 @@ + + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a915d6ed..a328431e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@polymer/polymer", - "version": "2.3.0", + "version": "2.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c0d8e4da..7ba5ceb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@polymer/polymer", - "version": "2.3.0", + "version": "2.3.1", "description": "The Polymer library makes it easy to create your own web components. Give your element some markup and properties, and then use it on a site. Polymer provides features like dynamic templates and data binding to reduce the amount of boilerplate you need to write", "main": "polymer.html", "directories": { diff --git a/polymer-element.html b/polymer-element.html index 9b8f911a..aeb4a0e1 100644 --- a/polymer-element.html +++ b/polymer-element.html @@ -8,6 +8,8 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> + + \ No newline at end of file diff --git a/polymer.html b/polymer.html index 0331373c..28552fdb 100644 --- a/polymer.html +++ b/polymer.html @@ -19,7 +19,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN + + diff --git a/test/runner.html b/test/runner.html index 1133d53d..3c3137c0 100644 --- a/test/runner.html +++ b/test/runner.html @@ -77,6 +77,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN 'unit/render-status.html', 'unit/dir.html', 'unit/shady-unscoped-style.html', + 'unit/html-tag.html' // 'unit/multi-style.html' ]; @@ -117,7 +118,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN // ce + sd becomes a single test iteration. matrix.push('wc-ce=true&wc-shadydom=true'); } - + // economize testing by testing css shimming // only against 1 environment (native or polyfill). if (window.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)')) { diff --git a/test/smoke/html-tag.html b/test/smoke/html-tag.html new file mode 100644 index 00000000..7f1ad95c --- /dev/null +++ b/test/smoke/html-tag.html @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/unit/html-tag.html b/test/unit/html-tag.html new file mode 100644 index 00000000..3fa75bd5 --- /dev/null +++ b/test/unit/html-tag.html @@ -0,0 +1,134 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/unit/styling-scoped.html b/test/unit/styling-scoped.html index 0330b19e..656a8ec1 100644 --- a/test/unit/styling-scoped.html +++ b/test/unit/styling-scoped.html @@ -660,6 +660,61 @@ HTMLImports.whenReady(function() { + + + + + + + + + + + + + +