close
Skip to content

Commit 37fe5d9

Browse files
committed
Fix potential exception in set-attribute scriptlet
1 parent 867c2fe commit 37fe5d9

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎src/js/resources/attribute.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ export function setAttrFn(
9090
const start = ( ) => {
9191
if ( applySetAttr() === false ) { return; }
9292
observer = new MutationObserver(onDomChanged);
93-
observer.observe(document.body, {
94-
subtree: true,
95-
childList: true,
96-
});
93+
const root = document.documentElement;
94+
if ( root instanceof self.Node === false ) { return; }
95+
observer.observe(root, { subtree: true, childList: true });
9796
};
9897
runAt(( ) => { start(); }, options.runAt || 'idle');
9998
}

0 commit comments

Comments
 (0)