Skip to content

Commit c259e58

Browse files
committed
fix sveltejs#2086: detach error when node is not attached to DOM
1 parent af0bfe4 commit c259e58

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/runtime/internal/dom.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ export function insert(target: Node, node: Node, anchor?: Node) {
77
}
88

99
export function detach(node: Node) {
10-
node.parentNode.removeChild(node);
10+
if (node.parentNode) {
11+
node.parentNode.removeChild(node);
12+
}
1113
}
1214

1315
export function detach_between(before: Node, after: Node) {

0 commit comments

Comments
 (0)