From 63addd39ecf27a7b0edd130839a93ec03e8a40fb Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Wed, 29 Jan 2020 10:40:33 -0800 Subject: [PATCH] Ensure telemetry system works with `legacyNoObservedAttributes` setting --- lib/legacy/legacy-element-mixin.js | 13 +++++++++++-- test/unit/legacy-noattributes.html | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/legacy/legacy-element-mixin.js b/lib/legacy/legacy-element-mixin.js index d84a5eb4a2..8939ecbf79 100644 --- a/lib/legacy/legacy-element-mixin.js +++ b/lib/legacy/legacy-element-mixin.js @@ -23,6 +23,7 @@ import { wrap } from '../utils/wrap.js'; import { scopeSubtree } from '../utils/scope-subtree.js'; import { legacyOptimizations, legacyNoObservedAttributes } from '../utils/settings.js'; import { findObservedAttributesGetter } from '../mixins/disable-upgrade-mixin.js'; +import { register } from '../utils/telemetry.js'; const DISABLED_ATTR = 'disable-upgrade'; @@ -165,8 +166,16 @@ export const LegacyElementMixin = dedupingMixin((base) => { // NOTE: Inlined for perf from version of DisableUpgradeMixin. static get observedAttributes() { - return legacyNoObservedAttributes ? [] : - observedAttributesGetter.call(this).concat(DISABLED_ATTR); + if (legacyNoObservedAttributes) { + // Ensure this element is property registered with the telemetry system. + if (!this.hasOwnProperty(JSCompiler_renameProperty('__observedAttributes', this))) { + this.__observedAttributes = []; + register(this.prototype); + } + return this.__observedAttributes; + } else { + return observedAttributesGetter.call(this).concat(DISABLED_ATTR); + } } // NOTE: Inlined for perf from version of DisableUpgradeMixin. diff --git a/test/unit/legacy-noattributes.html b/test/unit/legacy-noattributes.html index 66799153a0..6e5399f1cc 100644 --- a/test/unit/legacy-noattributes.html +++ b/test/unit/legacy-noattributes.html @@ -92,6 +92,7 @@