From 1b4a978162d8d67720418b64ab42ae54060e2701 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Tue, 21 Mar 2017 14:20:30 -0700 Subject: [PATCH] Remove support for lazy-upgrade inside dom-if and dom-repeat This is very complicated to set up, and I'm not sure there are actually any good use cases. If you can control when an element is stamped, you really don't need to use disable-upgrade on it. --- lib/mixins/lazy-upgrade-mixin.html | 27 --------------------------- test/unit/lazy-upgrade.html | 30 +++++++++++------------------- 2 files changed, 11 insertions(+), 46 deletions(-) diff --git a/lib/mixins/lazy-upgrade-mixin.html b/lib/mixins/lazy-upgrade-mixin.html index c70a325b36..2bfebfd20a 100644 --- a/lib/mixins/lazy-upgrade-mixin.html +++ b/lib/mixins/lazy-upgrade-mixin.html @@ -58,10 +58,6 @@ node.removeAttribute(LAZY_UPGRADE); } - function eventInCurrentScope(scope, event) { - return event.target === event.composedPath()[0]; - } - /** @polymerMixinClass */ return class LazyUpgrade extends base { static get properties() { @@ -84,8 +80,6 @@ } ready() { - // check for dom-repeat and dom-if elements stamping lazy-upgrade nodes - this.addEventListener('dom-change', (ev) => { this.__lazyUpgradeFromDomChange(ev) }); super.ready(); this.__lazyUpgradeQueue = findCandidates(this.shadowRoot || this); this._lazyUpgrading = true; @@ -108,27 +102,6 @@ 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(); - } - } } }); })(); diff --git a/test/unit/lazy-upgrade.html b/test/unit/lazy-upgrade.html index 1d8ca3017f..8359136f63 100644 --- a/test/unit/lazy-upgrade.html +++ b/test/unit/lazy-upgrade.html @@ -70,11 +70,15 @@ - + - +