Say I have an HTML hierarchy, for example:
<div id="container">
<div class="c">
<div class="c"></div>
</div>
<div class="c"></div>
<div class="c"></div>
</div>
I want to track the DOM for this HTML to know when a new element with a class is cinserted anywhere. From what I see in MutationObserver, there is no way to do this.
Instead, I should watch events #containerfor childListand keep track of the entire subtree. It would be nice if my real world code just mentioned above, but the DOM is huge and gets dynamic insertions / deletes all the time, which are not useful or necessary.
Did I miss some way of using MutationObserverto view the insertions of an element with a specific class?