From b7f009922c3e88df6eac82eb032ddef0d8ef4e33 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Mon, 17 Apr 2017 11:10:55 -0700 Subject: [PATCH] Ensure optimization uses hybrid parentNode --- src/lib/template/dom-if.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/template/dom-if.html b/src/lib/template/dom-if.html index 9d699a22c7..c06ddef99f 100644 --- a/src/lib/template/dom-if.html +++ b/src/lib/template/dom-if.html @@ -135,17 +135,17 @@ }, _ensureInstance: function() { + var refNode; var parentNode = Polymer.dom(this).parentNode; + // Affordance for 2.x hybrid mode + if (parentNode && parentNode.localName == this.is) { + refNode = parentNode; + parentNode = Polymer.dom(parentNode).parentNode; + } else { + refNode = this; + } // Guard against element being detached while render was queued if (parentNode) { - var refNode; - // Affordance for 2.x hybrid mode - if (parentNode.localName == this.is) { - refNode = parentNode; - parentNode = Polymer.dom(parentNode).parentNode; - } else { - refNode = this; - } if (!this._instance) { this._instance = this.stamp(); var root = this._instance.root; @@ -154,7 +154,7 @@ var c$ = this._instance._children; if (c$ && c$.length) { // Detect case where dom-if was re-attached in new position - var lastChild = Polymer.dom(this).previousSibling; + var lastChild = Polymer.dom(refNode).previousSibling; if (lastChild !== c$[c$.length-1]) { for (var i=0, n; (i