检测 DOM 更改事件
有没有办法检测 DOM 更改事件?无论是文本替换、移动节点、删除或添加新节点等。
Is there a way to detect DOM change events? whether it be text replacement, moving a node, removing or adding a new node, etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您正在寻找的是
DOMSubtreeModified
<强>编辑:经进一步检查,此事件和其他
MutationEvents
已已被 W3C 弃用,但没有似乎是 替换直到 DOM Level 4请参阅:“为什么 DOMSubtreeModified 事件在 DOM 级别 3 中被弃用?”
长话短说,
DOMSubtreeModified
仍然有效,并且没有跨稳定浏览器实现的合理替代方案。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 4See: "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.