Skip to content

Commit

Permalink
fix sveltejs#2086: detach error when node is not attached to DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
btakita committed Jul 7, 2019
1 parent 83be1f3 commit ca2b2dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/runtime/internal/dom.ts
Expand Up @@ -7,7 +7,9 @@ export function insert(target: Node, node: Node, anchor?: Node) {
}

export function detach(node: Node) {
node.parentNode.removeChild(node);
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}

export function detach_between(before: Node, after: Node) {
Expand Down

0 comments on commit ca2b2dd

Please sign in to comment.