mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Ensure DisableUpgradeMixin extends PropertiesMixin
This commit is contained in:
@@ -35,16 +35,30 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
*
|
||||
* @mixinFunction
|
||||
* @polymer
|
||||
* @appliesMixin Polymer.PropertiesChanged
|
||||
* @memberof Polymer
|
||||
*/
|
||||
Polymer.DisableUpgradeMixin = (base) => {
|
||||
Polymer.DisableUpgradeMixin = Polymer.dedupingMixin((base) => {
|
||||
|
||||
return class DisableUpgradeClass extends base {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {base}
|
||||
* @implements {Polymer_PropertiesMixin}
|
||||
*/
|
||||
const superClass = Polymer.PropertiesMixin(base);
|
||||
/**
|
||||
* @polymer
|
||||
* @mixinClass
|
||||
* @implements {Polymer_DisableUpgradeMixin}
|
||||
*/
|
||||
class DisableUpgradeClass extends superClass {
|
||||
|
||||
/** @override */
|
||||
static get observedAttributes() {
|
||||
return super.observedAttributes.concat(DISABLED_ATTR);
|
||||
}
|
||||
|
||||
/** @override */
|
||||
attributeChangedCallback(name, old, value) {
|
||||
if (name == DISABLED_ATTR) {
|
||||
if (!this.__dataEnabled && value == null && this.isConnected) {
|
||||
@@ -60,9 +74,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
attributes are delivered. Therefore, we stub this out and
|
||||
call `super._initializeProperties()` manually.
|
||||
*/
|
||||
/** @override */
|
||||
_initializeProperties() {}
|
||||
|
||||
// prevent user code in connected from running
|
||||
/** @override */
|
||||
connectedCallback() {
|
||||
if (this.__dataEnabled || !this.hasAttribute(DISABLED_ATTR)) {
|
||||
super.connectedCallback();
|
||||
@@ -70,6 +86,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
|
||||
// prevent element from turning on properties
|
||||
/** @override */
|
||||
_enableProperties() {
|
||||
if (!this.hasAttribute(DISABLED_ATTR)) {
|
||||
if (!this.__dataEnabled) {
|
||||
@@ -80,15 +97,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
|
||||
// only go if "enabled"
|
||||
/** @override */
|
||||
disconnectedCallback() {
|
||||
if (this.__dataEnabled) {
|
||||
super.disconnectedCallback();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
return DisableUpgradeClass;
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user