Skip to content

Commit

Permalink
Fix test failures by feature detecting instance properties accessors.
Browse files Browse the repository at this point in the history
Can't rely on `__proto__` on IE10, but that browser doesn't need to avoid `properties`.
  • Loading branch information
kevinpschaaf committed Feb 17, 2017
1 parent a68c0b3 commit f2a12cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/standard/configure.html
Expand Up @@ -43,6 +43,11 @@

var usePolyfillProto = Polymer.Settings.usePolyfillProto;

// When true, `this.properties` is bad juju due to obsolete `properties`
// accessors on instances of HTMLElement
var avoidInstanceProperties =
Boolean(Object.getOwnPropertyDescriptor(document.body, 'properties'));

Polymer.Base._addFeature({

// storage for configuration
Expand Down Expand Up @@ -106,7 +111,8 @@
// property, and b.) the `properties` accessor is on instances rather
// than `HTMLElement.prototype`; going under the instance to the prototype
// avoids the problem.
this._configureProperties(this.__proto__.properties, config);
this._configureProperties(avoidInstanceProperties ?
this.__proto__.properties : this.properties, config);
// TODO(sorvell): it *may* be faster to loop over _propertyInfo but
// there are some test issues.
//this._configureProperties(this._propertyInfo, config);
Expand Down

0 comments on commit f2a12cb

Please sign in to comment.