1

I am trying to implement a delete event DOM manipulation functionality using MutationObserver JavaScript library, and this line causes me confusion:

const config = {attributes: true, childList: true, subtree: true};

I did not find any explanation about what is the difference between childList and subtree, and when is it appropriate to use either one?

Can anyone clarify? Thanks!

Dennis Kozevnikoff
  • 2,078
  • 3
  • 19
  • 29
  • 1
    [Children](//en.wikipedia.org/wiki/Tree_%28data_structure%29) are the _immediate_ descendants. The subtree includes _all_ descendants. Have you read the [documentation](//developer.mozilla.org/docs/Web/API/MutationObserverInit)? – Sebastian Simon Aug 03 '21 at 16:24
  • Hi there. Suggest looking at this [thread](https://stackoverflow.com/questions/10560356/mutation-observers-subtree) for an explanation. This question is probably a duplicate – teemoleen Dec 27 '21 at 23:54
  • 1
    @SebastianSimon I also ended up here since the difference is well explained at all. And after reading and comparing it multiple time, still not. – Marc Mar 02 '22 at 13:13

0 Answers0