Best approach for using mutationObservers on elements which get destroyed

Viewed 3370

I'm trying to run a script on an Angular 1 site, my script looks for changes in the DOM to run a function. However since it's a single page app, my preferred mutation target node can be destroyed and replaced which stops the mutationObserver from working as its target no longer exists. I feel like targeting one of the parent nodes is a bit messy as it will be picking up hundreds of mutations and looking for my preferred one.

Are there any better approaches I could use?

1 Answers
Related