From 2afe2364e4e8ad4cf9f5284e5f250b5c71bb3231 Mon Sep 17 00:00:00 2001 From: Jaxon Lewis-Wilson Date: Tue, 27 Jan 2026 16:09:15 +0800 Subject: [PATCH] Narrowed trigger criteria Instead of running every time document.head mutates, only run when mutation is an attribute change, target is a link, rel includes icon, and attribute is href. --- src/SEQTA.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/SEQTA.ts b/src/SEQTA.ts index 02fb29fe..70773ca1 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -52,17 +52,29 @@ async function init() { replaceIcons(); - const observer = new MutationObserver(() => { - replaceIcons(); + const observer = new MutationObserver((mutations) => { + for (const mutation of mutations) { + + if ( + mutation.type === "attributes" && + mutation.target instanceof HTMLLinkElement && + mutation.target.rel.includes("icon") && + mutation.attributeName === "href" + ) { + replaceIcons(); + return; + } + } }); observer.observe(document.head, { - childList: true, subtree: true, attributes: true, - attributeFilter: ["href", "rel"], + attributeFilter: ["href"], }); + + try { await initializeSettingsState();