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 3 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
13 changes: 12 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,13 @@
this._configureProperties(this.behaviors[i].properties, config);
}
// prototypical behavior
this._configureProperties(this.properties, config);
// Read `properties` off of the prototype, as an concession to non-spec
// compliant browsers 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.
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