diff --git a/extensions/chromium/contentscript.js b/extensions/chromium/contentscript.js index b0aa553000527..1e596c4936ece 100644 --- a/extensions/chromium/contentscript.js +++ b/extensions/chromium/contentscript.js @@ -132,8 +132,12 @@ function updateEmbedElement(elem) { } elem.type = "text/html"; elem.src = getEmbeddedViewerURL(elem.src); + if (parentNode) { - nextSibling.before(elem); + // Suppress linter warning: insertBefore is preferable to + // nextSibling.before(elem) because nextSibling may be null. + // eslint-disable-next-line unicorn/prefer-modern-dom-apis + parentNode.insertBefore(elem, nextSibling); } }