diff --git a/lib/mixins/lazy-upgrade-mixin.html b/lib/mixins/lazy-upgrade-mixin.html
index 174cedc0f6..c70a325b36 100644
--- a/lib/mixins/lazy-upgrade-mixin.html
+++ b/lib/mixins/lazy-upgrade-mixin.html
@@ -84,27 +84,11 @@
}
ready() {
- super.ready();
// check for dom-repeat and dom-if elements stamping lazy-upgrade nodes
- this.addEventListener('dom-change', (ev) => {
- if (!eventInCurrentScope(this, ev)) {
- return;
- }
- let root = ev.composedPath()[0].parentNode;
- let candidates = findCandidates(root);
- for (let i = 0; i < candidates.length; i++) {
- let c = candidates[i];
- if (this.__lazyUpgradeQueue.indexOf(c) === -1) {
- this.__lazyUpgradeQueue.push(c);
- }
- }
- if (candidates.length && !this._lazyUpgrading) {
- this._lazyUpgrading = true;
- this.__lazyUpgrade();
- }
- });
- this._lazyUpgrading = true;
+ this.addEventListener('dom-change', (ev) => { this.__lazyUpgradeFromDomChange(ev) });
+ super.ready();
this.__lazyUpgradeQueue = findCandidates(this.shadowRoot || this);
+ this._lazyUpgrading = true;
this.__lazyUpgrade();
}
@@ -124,6 +108,27 @@
this._lazyUpgrading = false;
}
}
+
+ /**
+ * @private
+ */
+ __lazyUpgradeFromDomChange(ev) {
+ if (!eventInCurrentScope(this, ev)) {
+ return;
+ }
+ let root = ev.composedPath()[0].parentNode;
+ let candidates = findCandidates(root);
+ for (let i = 0; i < candidates.length; i++) {
+ let c = candidates[i];
+ if (this.__lazyUpgradeQueue.indexOf(c) === -1) {
+ this.__lazyUpgradeQueue.push(c);
+ }
+ }
+ if (candidates.length && !this._lazyUpgrading) {
+ this._lazyUpgrading = true;
+ this.__lazyUpgrade();
+ }
+ }
}
});
})();