Unverified Commit 9aadd1aa authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix forEach error in CSS commit in ie11 (#16282)

This fixes an error that was occurring in ie11 due to `forEach` being called on `querySelectorAll` before it was massaged to an array.

x-ref: https://github.com/vercel/next.js/pull/16126
Fixes #16283
parent d824189b
...@@ -641,7 +641,9 @@ async function doRender({ ...@@ -641,7 +641,9 @@ async function doRender({
} }
function onAbort() { function onAbort() {
document.querySelectorAll('link[data-n-staging]').forEach((el) => { ;([].slice.call(
document.querySelectorAll('link[data-n-staging]')
) as HTMLLinkElement[]).forEach((el) => {
el.remove() el.remove()
}) })
} }
...@@ -660,7 +662,9 @@ async function doRender({ ...@@ -660,7 +662,9 @@ async function doRender({
process.env.NODE_ENV === 'production' process.env.NODE_ENV === 'production'
) { ) {
// Remove old stylesheets: // Remove old stylesheets:
document.querySelectorAll('link[data-n-p]').forEach((el) => el.remove()) ;([].slice.call(
document.querySelectorAll('link[data-n-p]')
) as HTMLLinkElement[]).forEach((el) => el.remove())
// Activate new stylesheets: // Activate new stylesheets:
;[].slice ;[].slice
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment