Skip to content

Commit 0cf3611

Browse files
committed
use parentNode.remove() for compatibility with IE
1 parent 76b2302 commit 0cf3611

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/gatsby/cache-dir/head/head-export-handler-for-browser.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const removePrevHeadElements = () => {
1818
const prevHeadNodes = document.querySelectorAll(`[data-gatsby-head]`)
1919

2020
for (const node of prevHeadNodes) {
21-
node.remove()
21+
node.parentNode.removeChild(node)
2222
}
2323
}
2424

@@ -52,7 +52,9 @@ const onHeadRendered = () => {
5252
seenIds.set(id, validHeadNodes.length - 1)
5353
} else {
5454
const indexOfPreviouslyInsertedNode = seenIds.get(id)
55-
validHeadNodes[indexOfPreviouslyInsertedNode].remove()
55+
validHeadNodes[indexOfPreviouslyInsertedNode].parentNode.removeChild(
56+
validHeadNodes[indexOfPreviouslyInsertedNode]
57+
)
5658
validHeadNodes[indexOfPreviouslyInsertedNode] = clonedNode
5759
}
5860
} else {
@@ -72,7 +74,7 @@ const onHeadRendered = () => {
7274
diffNodes({
7375
oldNodes: existingHeadElements,
7476
newNodes: validHeadNodes,
75-
onStale: node => node.remove(),
77+
onStale: node => node.parentNode.removeChild(node),
7678
onNew: node => newHeadNodes.push(node),
7779
})
7880

0 commit comments

Comments
 (0)