diff --git a/apply.js b/apply.js index 7c3b7161..a2f523b2 100644 --- a/apply.js +++ b/apply.js @@ -246,6 +246,9 @@ function initDocRewriteObserver() { } // re-add styles if we detect documentElement being recreated const reinjectStyles = () => { + if (!styleElements) { + return orphanCheck && orphanCheck(); + } ROOT = document.documentElement; for (const el of styleElements.values()) { addStyleElement(document.importNode(el, true));