From bbc0373c3cc608ee1b963c016c26534596c327d0 Mon Sep 17 00:00:00 2001 From: Keanu Lee Date: Fri, 7 Apr 2017 15:14:17 -0700 Subject: [PATCH 1/7] Import mutable-data.html in dom-bind --- lib/elements/dom-bind.html | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/elements/dom-bind.html b/lib/elements/dom-bind.html index d08ca0e37c..7a95321a72 100644 --- a/lib/elements/dom-bind.html +++ b/lib/elements/dom-bind.html @@ -10,6 +10,7 @@ + From dea052a2b0e07fc923d20ad47f36e2366e324a9e Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 10 Apr 2017 11:39:42 -0700 Subject: [PATCH 3/7] Various Safari 10.1 fixes Fix infinite loop on `Polymer.Gestures.deepTargetFind` Fix styling test for changes caused by webcomponentsjs/shadycss#79 Skip styling test broken by safari bug --- lib/utils/gestures.html | 5 +++++ test/unit/styling-cross-scope-var.html | 6 ++++++ test/unit/styling-scoped.html | 8 +------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/utils/gestures.html b/lib/utils/gestures.html index c81b51cd6f..01f4660734 100644 --- a/lib/utils/gestures.html +++ b/lib/utils/gestures.html @@ -244,7 +244,12 @@ // if there is not a shadowroot, exit the loop while (next && next.shadowRoot && !window.ShadyDOM) { // if there is a node at x/y in the shadowroot, look deeper + let oldNext = next; next = next.shadowRoot.elementFromPoint(x, y); + // on Safari, elementFromPoint may return the shadowRoot host + if (oldNext === next) { + break; + } if (next) { node = next; } diff --git a/test/unit/styling-cross-scope-var.html b/test/unit/styling-cross-scope-var.html index c45d7fa9e4..9e799124fb 100644 --- a/test/unit/styling-cross-scope-var.html +++ b/test/unit/styling-cross-scope-var.html @@ -752,6 +752,8 @@ suite('scoped-styling-var', function() { function assertComputed(element, value, pseudo, name) { + // force a style-recalc for Safari + element.offsetWidth; name = name || 'border-top-width'; var computed = element.getComputedStyleValue && !pseudo ? element.getComputedStyleValue(name) : @@ -787,6 +789,10 @@ }); test('instances of scoped @keyframes', function(done) { + if (navigator.userAgent.match(/Safari\/603/) && ShadyCSS.nativeCss && ShadyCSS.nativeShadow) { + // `:nth-of-type` is broken in shadow roots on Safari 10.1 + this.skip(); + } var xKeyframes = styled.$.keyframes2; var onAnimationEnd = function() { assertStylePropertyValue(xKeyframes, 'left', '5px'); diff --git a/test/unit/styling-scoped.html b/test/unit/styling-scoped.html index 2bb5c88728..feb262e40e 100644 --- a/test/unit/styling-scoped.html +++ b/test/unit/styling-scoped.html @@ -759,13 +759,7 @@ Polymer.flush(); assert.notInclude(d.getAttribute('style-scoped') || '', styled.is, 'scoping attribute not removed when added to other root'); assert.notInclude(d.className, styled.is, 'scoping class not removed when added to other root'); - Polymer.dom(styled.root).appendChild(d); - Polymer.flush(); - assertComputed(d, '4px'); - Polymer.dom(styled.root).removeChild(d); - Polymer.flush(); - assert.notInclude(d.getAttribute('style-scoped') || '', styled.is, 'scoping attribute not removed when removed from root'); - assert.notInclude(d.className, styled.is, 'scoping class not removed when removed from root'); + assertComputed(d, '0px'); Polymer.dom(styled.root).appendChild(d); Polymer.flush(); assertComputed(d, '4px'); From ef90168be9a7243b417c542c0047ebd48995deae Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 10 Apr 2017 16:43:01 -0700 Subject: [PATCH 4/7] [ci skip] note safari bugs --- test/unit/styling-cross-scope-var.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/unit/styling-cross-scope-var.html b/test/unit/styling-cross-scope-var.html index 9e799124fb..4747494fe6 100644 --- a/test/unit/styling-cross-scope-var.html +++ b/test/unit/styling-cross-scope-var.html @@ -752,7 +752,8 @@ suite('scoped-styling-var', function() { function assertComputed(element, value, pseudo, name) { - // force a style-recalc for Safari + // force a style-recalc for Safari missing updated CSS Custom Properties + // https://bugs.webkit.org/show_bug.cgi?id=170708 element.offsetWidth; name = name || 'border-top-width'; var computed = element.getComputedStyleValue && !pseudo ? @@ -791,6 +792,7 @@ test('instances of scoped @keyframes', function(done) { if (navigator.userAgent.match(/Safari\/603/) && ShadyCSS.nativeCss && ShadyCSS.nativeShadow) { // `:nth-of-type` is broken in shadow roots on Safari 10.1 + // https://bugs.webkit.org/show_bug.cgi?id=166748 this.skip(); } var xKeyframes = styled.$.keyframes2; From 2356f7b8f08ba6b2a4a19f59de5abeff7081383c Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Tue, 11 Apr 2017 11:01:39 -0700 Subject: [PATCH 5/7] Only style elements with templates dom-repeat and/or dom-if booting before custom-style is registered can break the complicated loading strategy of ShadyCSS. By only calling ShadyCSS for elements with templates, we both fix this issue and improve performance for template-less element booting Fixes #4521 --- lib/mixins/element-mixin.html | 2 +- test/runner.html | 1 + test/unit/styling-only-with-template.html | 78 +++++++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 test/unit/styling-only-with-template.html diff --git a/lib/mixins/element-mixin.html b/lib/mixins/element-mixin.html index 30af1ec1a7..f00316c6e8 100644 --- a/lib/mixins/element-mixin.html +++ b/lib/mixins/element-mixin.html @@ -596,7 +596,7 @@ * @override */ connectedCallback() { - if (window.ShadyCSS) { + if (window.ShadyCSS && this._template) { window.ShadyCSS.styleElement(this); } if (!this.__dataInitialized) { diff --git a/test/runner.html b/test/runner.html index 9a9f1b003a..3b35f9c9f1 100644 --- a/test/runner.html +++ b/test/runner.html @@ -36,6 +36,7 @@ 'unit/styling-cross-scope-var.html', 'unit/styling-cross-scope-apply.html', 'unit/styling-cross-scope-unknown-host.html', + 'unit/styling-only-with-template.html', 'unit/custom-style.html', 'unit/custom-style-late.html', 'unit/custom-style-async.html', diff --git a/test/unit/styling-only-with-template.html b/test/unit/styling-only-with-template.html new file mode 100644 index 0000000000..8239ad595d --- /dev/null +++ b/test/unit/styling-only-with-template.html @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + \ No newline at end of file From e397c434e54ac7b67569b15422cba5cae825a766 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Tue, 11 Apr 2017 11:09:55 -0700 Subject: [PATCH 6/7] fix lint error --- test/unit/styling-only-with-template.html | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/styling-only-with-template.html b/test/unit/styling-only-with-template.html index 8239ad595d..5134867a36 100644 --- a/test/unit/styling-only-with-template.html +++ b/test/unit/styling-only-with-template.html @@ -70,6 +70,7 @@ test('dom-repeat and dom-if do not break custom-style', () => { // force custom-style flushing + let target = document.querySelector('#target'); window.ShadyCSS.styleDocument(); assertComputed(target, '2px'); }); From afa843ccddaaed41e3132ad7b805b3b4244364d1 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Wed, 12 Apr 2017 15:35:05 -0700 Subject: [PATCH 7/7] [ci skip] v2.0.0-rc.4 --- bower.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 434ce7e1f2..a6776b489b 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "polymer", - "version": "2.0.0-rc.3", + "version": "2.0.0-rc.4", "main": [ "polymer.html" ], diff --git a/package.json b/package.json index 5abd923fb5..b68dbd830c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@polymer/polymer", - "version": "2.0.0-rc.3", + "version": "2.0.0-rc.4", "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": {