Skip to content

Commit

Permalink
Merge pull request #117 from abdnh/remove-child-fix
Browse files Browse the repository at this point in the history
Fix DOMException triggered by .removeChild() in specific situations
  • Loading branch information
hgiesel authored Jan 3, 2024
2 parents 769dc2f + 53ccc21 commit f9926dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/template/browser/childNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ export class ChildNodeSpan {
this.parentElement.childNodes[this._fromIndex],
);
for (const node of this.span()) {
this.parentElement.removeChild(node);
if(node.parentElement === this.parentElement) {
this.parentElement.removeChild(node);
}
}

// might turn the original div into multiple nodes including text nodes
Expand Down

0 comments on commit f9926dc

Please sign in to comment.