2

Is there a way to detect DOM change events? whether it be text replacement, moving a node, removing or adding a new node, etc.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Kar
  • 6,063
  • 7
  • 53
  • 82

1 Answers1

2

I think what you're looking for is DOMSubtreeModified

Edit: upon further inspection this and other MutationEvents have been deprecated by the W3C but there doesn't appear to be a replacement until DOM Level 4

See: "Why is the DOMSubtreeModified event deprecated in DOM level 3?"

Long story short, DOMSubtreeModified will still work and there is no reasonable alternative implemented across stable browsers.

Community
  • 1
  • 1
Ansel Santosa
  • 8,224
  • 1
  • 28
  • 39
  • You can use [`animationStart` and some CSS](http://stackoverflow.com/a/13835369/237285) to achieve the same effect on modern, stable browsers. – Andres Riofrio Dec 12 '12 at 08:12
  • Nine years later, [`MutationObserver`](https://stackoverflow.com/a/3219767/157247) is the stable, well-supported way to do this. – T.J. Crowder Mar 09 '21 at 09:02