From b3568bb32b926b1cd1790c6fdf0fb238d13c7a99 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Tue, 6 Nov 2018 17:51:19 -0800 Subject: [PATCH] Sync memoized properties getter with 3.x version. --- lib/mixins/properties-mixin.html | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/mixins/properties-mixin.html b/lib/mixins/properties-mixin.html index 0e6da40389..47e2f2fd0a 100644 --- a/lib/mixins/properties-mixin.html +++ b/lib/mixins/properties-mixin.html @@ -93,8 +93,12 @@ 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 @@ * @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; } /**