diff --git a/lib/mixins/property-effects.js b/lib/mixins/property-effects.js index 3b7d9ee8eb..a939d2ac0d 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -2703,12 +2703,12 @@ export const PropertyEffects = dedupingMixin(superClass => { // effects are run; if this template was not nested in another // template, use the root template (the first stamped one) as the // parent. Note, `parent` is the `templateInfo` instance for this - // template's containing template, which was set up in - // `applyTemplateContent`. While a given template's `parent` is - // given, it is only added to the parent list at the point that it is - // being bound, since a template may or may not ever be stamped, and - // may be stamped more than once (in which case it will be in the - // tree more than once). + // template's parent (containing) template, which was set up in + // `applyTemplateContent`. While a given template's `parent` is set + // apriori, it is only added to the parent list at the point that it + // is being bound, since a template may or may not ever be stamped, + // and may be stamped more than once (in which case instances of the + // template info will be in the tree under its parent more than once). const parent = templateInfo.parent || this.__templateInfo; const previous = parent.lastChild; parent.lastChild = templateInfo; @@ -2807,7 +2807,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * @protected */ _removeBoundDom(dom) { - // Unlink template info; Note that while the child is unlinked from its + // Unlink template info; Note that while the child is unlinked from its // parent list, a template's `parent` reference is never removed, since // this is is determined by the tree structure and applied at // `applyTemplateContent` time. @@ -2964,10 +2964,12 @@ export const PropertyEffects = dedupingMixin(superClass => { // onto the parent (dom-if/repeat element)'s nodeInfo if (removeNestedTemplates && (isDomIf || isDomRepeat)) { parent.removeChild(node); - nodeInfo.parentInfo.templateInfo = nestedTemplateInfo; - // Ensure the parent dom-if/repeat is noted since it now has bindings; - // it may not have been if it did not have its own bindings + // Use the parent's nodeInfo (for the dom-if/repeat) to record the + // templateInfo, and use that for any host property bindings below nodeInfo = nodeInfo.parentInfo; + nodeInfo.templateInfo = nestedTemplateInfo; + // Ensure the parent dom-if/repeat is noted since it now may have host + // bindings; it may not have been if it did not have its own bindings nodeInfo.noted = true; noted = false; }