diff --git a/content/apply.js b/content/apply.js index 36dde7c7..88b605f9 100644 --- a/content/apply.js +++ b/content/apply.js @@ -382,12 +382,17 @@ if (next === newElement.nextElementSibling) { return; } - docRootObserver.evade(() => { + const insert = () => { ROOT.insertBefore(newElement, next || null); if (disableAll) { newElement.disabled = true; } - }); + }; + if (docRootObserver) { + docRootObserver.evade(insert); + } else { + insert(); + } } function replaceAll(newStyles) { diff --git a/js/msg.js b/js/msg.js index ca47ee52..f79e242b 100644 --- a/js/msg.js +++ b/js/msg.js @@ -32,7 +32,7 @@ const msg = (() => { sendBg, broadcast, broadcastTab, - broadcastExtension: send, // alias of send + broadcastExtension, on, onTab, onExtension, @@ -122,6 +122,10 @@ const msg = (() => { }); } + function broadcastExtension(...args) { + return send(...args).catch(console.warn); + } + function on(fn) { initHandler(); handler.both.push(fn); diff --git a/popup/popup.js b/popup/popup.js index 8321a072..4afedbbd 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -323,7 +323,7 @@ function createStyleElement({ if (!style.usercssData && style.updateUrl && style.updateUrl.includes('?') && style.url) { config.href = style.url; } else { - config.href = ''; + config.removeAttribute('href'); } config.style.display = !style.usercssData && config.href ||