From ecd9b0902d6753d9f1aff2d02ff408796d37ab3c Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Sun, 23 Aug 2015 00:23:31 +0200 Subject: [PATCH 1/2] Fix for getters/setters for property become inaccessible when property set on element before it is ready Test added --- src/standard/configure.html | 6 ++++-- test/unit/configure-elements.html | 26 +++++++++++++++++++++++++- test/unit/configure.html | 8 ++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/standard/configure.html b/src/standard/configure.html index 8d4102a7..59bb3604 100644 --- a/src/standard/configure.html +++ b/src/standard/configure.html @@ -114,8 +114,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN _configureProperties: function(properties, config) { for (var i in properties) { var c = properties[i]; - // don't accept undefined values - if (c.value !== undefined) { + if (this[i] !== undefined) { + config[i] = this[i]; + delete this[i]; + } else if (c.value !== undefined) { var value = c.value; if (typeof value == 'function') { // pass existing config values (this._config) to value function diff --git a/test/unit/configure-elements.html b/test/unit/configure-elements.html index c3eee344..3778a2bd 100644 --- a/test/unit/configure-elements.html +++ b/test/unit/configure-elements.html @@ -164,4 +164,28 @@ }); - \ No newline at end of file + + + + diff --git a/test/unit/configure.html b/test/unit/configure.html index 40381e83..8143d2dc 100644 --- a/test/unit/configure.html +++ b/test/unit/configure.html @@ -26,6 +26,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN + + + + From ef629f4c4bff0252c72fbfd06043e9a7ef1dc6e1 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Fri, 12 Feb 2016 18:39:48 -0800 Subject: [PATCH 2/2] Undo fix on IE10 where the custom elements polyfill's mixin strategy makes this unfeasible. --- src/lib/settings.html | 5 ++++- src/standard/configure.html | 7 +++++-- test/unit/configure.html | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib/settings.html b/src/lib/settings.html index 77eccef2..7e4c4288 100644 --- a/src/lib/settings.html +++ b/src/lib/settings.html @@ -38,6 +38,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN var useNativeCustomElements = (!window.CustomElements || window.CustomElements.useNative); + var usePolyfillProto = !useNativeCustomElements && !Object.__proto__; + return { wantShadow: wantShadow, hasShadow: hasShadow, @@ -45,7 +47,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN useShadow: useShadow, useNativeShadow: useShadow && nativeShadow, useNativeImports: useNativeImports, - useNativeCustomElements: useNativeCustomElements + useNativeCustomElements: useNativeCustomElements, + usePolyfillProto: usePolyfillProto }; })() }; diff --git a/src/standard/configure.html b/src/standard/configure.html index 0619bad2..b994b003 100644 --- a/src/standard/configure.html +++ b/src/standard/configure.html @@ -9,7 +9,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN --> diff --git a/test/unit/configure.html b/test/unit/configure.html index a51a1d75..dc125a89 100644 --- a/test/unit/configure.html +++ b/test/unit/configure.html @@ -104,6 +104,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN }); test('pre-register property assignment does not break getters and setters', function() { + // don't test if __proto__ is polyfilled (IE10); cannot be fixed in this case. + if (Polymer.Settings.usePolyfillProto) { + return; + } var x = document.createElement('x-late-register'); document.body.appendChild(x); // set property