DOM 更改事件 Firefox 扩展
所以我创建了一个 Firefox 扩展,它运行得很好,但是当我提交它时(尽管它被接受)它出现了一个安全警告。它说 setTimeout() 在 else 子句中被删除。
那么,有没有办法监听 DOM 的变化呢? (或者甚至是特定元素发生变化,我都有一个 ID)。但是,div 没有 onChange 事件,所以有什么想法吗?
我不介意是否有任何改变,不必是特定于 div 的。
So I have created a Firefox extension and it works great, however when I submitted it (although it was accepted) it came up with one security warning. It said setTimeout() was removed in an else clause.
So, is there a way to listen for any DOM change? (or even a specific element changing, I have an ID for both). However, divs do not have an onChange event so any ideas?
I don't mind if it's ANY change, doesn't have to be div-specific.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
DOMSubtreeModified
事件听起来像您想要使用的东西。请记住,它已被弃用,并且在一段时间后,它的支持可能会从浏览器中删除。http://help.dottoro.com/ljrmcldi.php
DOMSubtreeModified
event sound like something you want to use. Keep in mind, that it is deprecated and after some time its support will probably be removed from browsers.http://help.dottoro.com/ljrmcldi.php
事实证明,向 div 添加“onChange”事件效果很好,尽管它可能不是 W3C 有效的,但这并不重要,因为它只是一个 Firefox 扩展(而且它有效!)。
It turns out adding an "onChange" event to a div works fine, although it might not be W3C valid it doesn't really matter as it's only a Firefox extension (plus it works!).