检测DOM更改事件 [英] Detecting DOM change events

查看:197
本文介绍了检测DOM更改事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法检测DOM更改事件?无论是文本替换,移动节点,删除或添加新节点等。

解决方案

我想你是寻找是 DOMSubtreeModified



编辑:进一步检查此和其他 MutationEvents 已经但似乎没有替换为DOM 4级



请参阅:为什么在DOM级别3中弃用了DOMSubtreeModified事件?



长篇小说, DOMSubtreeModifie d 仍然可以正常工作,并且在稳定的浏览器之间没有合理的替代方案。


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

解决方案

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.

这篇关于检测DOM更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆