对于DOM元素的所有更改,我可以使用调试器进行破坏吗? [英] Can I break with debugger on all changes to a DOM element?

查看:140
本文介绍了对于DOM元素的所有更改,我可以使用调试器进行破坏吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很希望能够看到影响特定DOM元素的代码。

I would really love to be able to see the code that is affecting a specific DOM element.

但是我也真的很想不要看看所有的我的javascript搜索可能导致问题的引用/选择器。

But I also would really love not to have to look through all my javascript searching for references/selectors that might be causing the issue.

有没有人有一种技术,导致浏览器调试器打破对特定DOM元素的任何更改?我不介意需要一个特定的浏览器或扩展名来工作。

Does anyone have a technique for causing a browser debugger to break on any changes to a specific DOM element? I don't mind it requiring a specific browser or extension to work.

推荐答案

以及Chrome的开发人员工具(也许其他人没有进一步检查)。

This is also doable without writing any script in Firebug as well as in Chrome's developer tools (maybe others, did not inspect further).

在Firebug中:


  1. 转到HTML标签

  2. 右键单击要监视的元素

  3. 选择暂停属性更改或拆分儿童添加或删除或拆除元素

在Chrome开发人员工具中

In Chrome Developer Tools


  1. 转到元素标签

  2. 右键单击要监视的元素

  3. 选择Break On ...,然后选择Subtree Modification,或Attributes Modification或Node Removal

我在尝试接受999的答案后才发现了这一点,但是给定的代码对我来说并不奏效。此外,Chrome可以监控任何DOM子树上的事件似乎非常棒。

I actually found this out after trying accepted answer of 999, however given code did not work for me. Additionally, Chrome's possibility to monitor events on any DOM subtree seems really nice.

这篇关于对于DOM元素的所有更改,我可以使用调试器进行破坏吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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