Sync memoized properties getter with 3.x version.

This commit is contained in:
Kevin Schaaf
2018-11-06 17:51:19 -08:00
parent 9d33ecb9a5
commit b3568bb32b
+12 -5
View File
@@ -93,8 +93,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
if (!constructor.hasOwnProperty(JSCompiler_renameProperty('__ownProperties', constructor))) {
let props = null;
if (constructor.hasOwnProperty(JSCompiler_renameProperty('properties', constructor)) && constructor.properties) {
props = normalizeProperties(constructor.properties);
if (constructor.hasOwnProperty(JSCompiler_renameProperty('properties', constructor))) {
const properties = constructor.properties;
if (properties) {
props = normalizeProperties(properties);
}
}
constructor.__ownProperties = props;
@@ -117,9 +121,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do
*/
static get observedAttributes() {
Polymer.telemetry.register(this.prototype);
const props = this._properties;
return props ? Object.keys(props).map(p => this.attributeNameForProperty(p)) : [];
if (!this.hasOwnProperty('__observedAttributes')) {
Polymer.telemetry.register(this.prototype);
const props = this._properties;
this.__observedAttributes = props ? Object.keys(props).map(p => this.attributeNameForProperty(p)) : [];
}
return this.__observedAttributes;
}
/**