DOM MutationObserver
A document observation mechanism is represented with MutationObserver , that is easy to configure, and it is used to register listeners that can be notified of any changes in the document tree. The following example demonstrates the implementation of MutationObserver and how to use it to observe adding new nodes to the document.
If you are observing a node for changes, your callback will not be fired until the DOM has completely finished changing. This behavior was designed to replace DOM Mutation Events and reduce the killing performance issue in the previous specification.