From c97168619a47a56b547a58c19854957f80217fc7 Mon Sep 17 00:00:00 2001 From: Jude Agboola Date: Tue, 9 Aug 2022 11:10:31 +0100 Subject: [PATCH] use parentNode.removeChild() for compatibility with IE --- .../cache-dir/head/head-export-handler-for-browser.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/gatsby/cache-dir/head/head-export-handler-for-browser.js b/packages/gatsby/cache-dir/head/head-export-handler-for-browser.js index f7f5234f1fe2f..101afbcb9f885 100644 --- a/packages/gatsby/cache-dir/head/head-export-handler-for-browser.js +++ b/packages/gatsby/cache-dir/head/head-export-handler-for-browser.js @@ -18,7 +18,7 @@ const removePrevHeadElements = () => { const prevHeadNodes = document.querySelectorAll(`[data-gatsby-head]`) for (const node of prevHeadNodes) { - node.remove() + node.parentNode.removeChild(node) } } @@ -52,7 +52,9 @@ const onHeadRendered = () => { seenIds.set(id, validHeadNodes.length - 1) } else { const indexOfPreviouslyInsertedNode = seenIds.get(id) - validHeadNodes[indexOfPreviouslyInsertedNode].remove() + validHeadNodes[indexOfPreviouslyInsertedNode].parentNode.removeChild( + validHeadNodes[indexOfPreviouslyInsertedNode] + ) validHeadNodes[indexOfPreviouslyInsertedNode] = clonedNode } } else { @@ -72,7 +74,7 @@ const onHeadRendered = () => { diffNodes({ oldNodes: existingHeadElements, newNodes: validHeadNodes, - onStale: node => node.remove(), + onStale: node => node.parentNode.removeChild(node), onNew: node => newHeadNodes.push(node), })