diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-06 12:06:27 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-06 12:06:27 +0800 |
commit | 1b37f7d7f1554f4ef4cd185c1181d54d9956b1db (patch) | |
tree | 54057c5cee90f3a93b240d77828f14f90af8c93f /snippets/javascript_mutationoberserver | |
parent | a9386c536189f2aaf38c9e2ba674a096657ca366 (diff) |
Update
Diffstat (limited to 'snippets/javascript_mutationoberserver')
-rw-r--r-- | snippets/javascript_mutationoberserver | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/snippets/javascript_mutationoberserver b/snippets/javascript_mutationoberserver new file mode 100644 index 0000000..48f17af --- /dev/null +++ b/snippets/javascript_mutationoberserver | |||
@@ -0,0 +1,12 @@ | |||
1 | new window.MutationObserver((ms) => { | ||
2 | for (const m of ms) { | ||
3 | console.log(m) | ||
4 | console.log('m', m.target.innerHTML) | ||
5 | console.log('m', m.target.classList) | ||
6 | } | ||
7 | }).observe(item, { | ||
8 | attributes: true, | ||
9 | attributeFilter: ['class'], | ||
10 | attributeOldValue: true, | ||
11 | characterDataOldValue: true | ||
12 | }) | ||