diff --git a/lib/legacy/legacy-element-mixin.html b/lib/legacy/legacy-element-mixin.html index 3ce281c363..0ecc44ee8a 100644 --- a/lib/legacy/legacy-element-mixin.html +++ b/lib/legacy/legacy-element-mixin.html @@ -73,14 +73,12 @@ constructor() { super(); - this.root = this; /** @type {boolean} */ this.isAttached; /** @type {WeakMap>} */ this.__boundListeners; /** @type {Object} */ this._debouncers; - this.created(); // Ensure listeners are applied immediately so that they are // added before declarative event listeners. This allows an element to // decorate itself via an event prior to any declarative listeners @@ -166,6 +164,8 @@ this._registered(); } super._initializeProperties(); + this.root = this; + this.created(); } /** diff --git a/lib/mixins/disable-upgrade-mixin.html b/lib/mixins/disable-upgrade-mixin.html index 17af982799..a430995dce 100644 --- a/lib/mixins/disable-upgrade-mixin.html +++ b/lib/mixins/disable-upgrade-mixin.html @@ -55,20 +55,26 @@ } } - __shouldEnable() { - return this.__dataEnabled || !this.hasAttribute(DISABLED_ATTR); - } + /* + NOTE: cannot gate on attribute because this is called before + attributes are delivered. Therefore, we stub this out and + call `super._initializeProperties()` manually. + */ + _initializeProperties() {} // prevent user code in connected from running connectedCallback() { - if (this.__shouldEnable()) { + if (this.__dataEnabled || !this.hasAttribute(DISABLED_ATTR)) { super.connectedCallback(); } } // prevent element from turning on properties _enableProperties() { - if (this.__shouldEnable()) { + if (!this.hasAttribute(DISABLED_ATTR)) { + if (!this.__dataEnabled) { + super._initializeProperties(); + } super._enableProperties(); } } diff --git a/test/unit/disable-upgrade.html b/test/unit/disable-upgrade.html index fd2b6cb1f7..533476e81b 100644 --- a/test/unit/disable-upgrade.html +++ b/test/unit/disable-upgrade.html @@ -57,6 +57,65 @@

[[prop]]

+ + + + + + +