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 2fc292b4..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 996dc62c..dc125a89 100644 --- a/test/unit/configure.html +++ b/test/unit/configure.html @@ -103,6 +103,36 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN assert.equal(e.$.child.attrNumberChanged.getCall(0).args[0], 42); }); + 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 + x.shouldChange = '1'; + // now register element + Polymer({ + is: 'x-late-register', + properties: { + shouldChange : { + observer: 'shouldChangeCallback', + type: String + } + }, + shouldChangeCallback: function() { + this.textContent = this.shouldChange; + } + }); + CustomElements.takeRecords(); + assert.equal(x.shouldChange, '1'); + assert.equal(x.shouldChange, x.textContent); + x.shouldChange = '2'; + assert.equal(x.shouldChange, '2'); + assert.equal(x.shouldChange, x.textContent); + document.body.removeChild(x); + }); });