Fix latent (benign) error thrown when removing dom-if via innerHTML.

This commit is contained in:
Kevin Schaaf
2018-07-06 18:11:34 -07:00
parent 8667b8955a
commit e3066924b7

View File

@@ -251,8 +251,10 @@ export class DomIf extends PolymerElement {
if (c$ && c$.length) {
// use first child parent, for case when dom-if may have been detached
let parent = c$[0].parentNode;
for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) {
parent.removeChild(n);
if (parent) {
for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) {
parent.removeChild(n);
}
}
}
this.__instance = null;