comparison mandarake-direct-link.user.js @ 132:8ccdc82249a2

[mandarake direct link] the attribute now set after element is added
author nanaya <me@nanaya.net>
date Sun, 07 Jan 2024 19:20:25 +0900
parents 8de2d53a4cb1
children 717bc604371b
comparison
equal deleted inserted replaced
131:77c5ac0ae047 132:8ccdc82249a2
45 function onMutate (mutations) { 45 function onMutate (mutations) {
46 for (const mutation of mutations) { 46 for (const mutation of mutations) {
47 for (const node of mutation.addedNodes) { 47 for (const node of mutation.addedNodes) {
48 run(node); 48 run(node);
49 } 49 }
50
51 if (mutation.target instanceof window.HTMLElement) {
52 run(mutation.target);
53 }
50 } 54 }
51 } 55 }
52 56
53 const observer = new window.MutationObserver(onMutate); 57 const observer = new window.MutationObserver(onMutate);
54 observer.observe(document, { childList: true, subtree: true }); 58 observer.observe(document, { childList: true, subtree: true });