admin管理员组

文章数量:1287230

Is it possible to observe innerHTML of node via mutationObserver? I'm trying to use characterData: true, but it does not shoot any callback on content change. full options list:

childList: true,
attributes: true,
characterData: true

Is it possible to observe innerHTML of node via mutationObserver? I'm trying to use characterData: true, but it does not shoot any callback on content change. full options list:

childList: true,
attributes: true,
characterData: true
Share Improve this question asked Jul 25, 2013 at 9:34 JabherJabher 3285 silver badges12 bronze badges 2
  • What kind of content change? – Tim Down Commented Jul 25, 2013 at 9:46
  • See stackoverflow./a/40195712 for a good answer; including the distinction to textContent – denis hebert Commented Jan 1, 2023 at 16:00
Add a ment  | 

1 Answer 1

Reset to default 11

Hi I think you need to add

subtree: true

in your options list.

Have a look at https://dvcs.w3/hg/domcore/raw-file/tip/Overview.html#mutation-observers

本文标签: javascriptmutationObserverhow to observe innerHTMLStack Overflow