Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read properties off of proto during configuration. #4314

Merged
merged 4 commits into from
Feb 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/standard/configure.html
Original file line number Diff line number Diff line change
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.documentElement, 'properties'));

Polymer.Base._addFeature({

// storage for configuration
Expand Down Expand Up @@ -101,7 +106,16 @@
this._configureProperties(this.behaviors[i].properties, config);
}
// prototypical behavior
this._configureProperties(this.properties, config);
// Read `properties` off of the prototype, as a concession to non-spec
// compliant browsers (e.g. Android UC Browser 11.2.0.915) where
// a.) HTMLElement's have a non-spec `properties` property, and
// b.) the `properties` accessor is on instances rather than
// `HTMLElement.prototype`; going under the instance to the prototype
// avoids the problem. Note can't always go to __proto__ due to IE10
// hence conditional, but IE10 doesn't suffer from the instance properties
// issue (happy coincidence of browser quirks).
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