diff --git a/package.json b/package.json index dfc756d..a92ecf8 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "type": "module", "scripts": { - "build": "deno build.ts --tagName 1.71.1b9 > ubo.js", + "build": "deno build.ts --tagName 1.71.1rc0 > ubo.js", "test": "node --test" }, "author": { diff --git a/ubo.js b/ubo.js index 4be8f44..3ebe736 100644 --- a/ubo.js +++ b/ubo.js @@ -119,10 +119,9 @@ function setAttrFn( const start = ( ) => { if ( applySetAttr() === false ) { return; } observer = new MutationObserver(onDomChanged); - observer.observe(document.body, { - subtree: true, - childList: true, - }); + const root = document.documentElement; + if ( root instanceof self.Node === false ) { return; } + observer.observe(root, { subtree: true, childList: true }); }; runAt(( ) => { start(); }, options.runAt || 'idle'); } @@ -425,10 +424,9 @@ function setAttrFn( const start = ( ) => { if ( applySetAttr() === false ) { return; } observer = new MutationObserver(onDomChanged); - observer.observe(document.body, { - subtree: true, - childList: true, - }); + const root = document.documentElement; + if ( root instanceof self.Node === false ) { return; } + observer.observe(root, { subtree: true, childList: true }); }; runAt(( ) => { start(); }, options.runAt || 'idle'); }