查找正在更改DOM元素的javascript [英] Find javascript that is changing DOM element

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

问题描述

有什么技巧可以用来查找javascript是否改变HTML元素?我有一些麻烦,找到一个特定元素如何获得一个内联样式的 display:none 加载加载。我知道我会找到最终这样做的脚本,但是我希望这个过程更容易。

Are there any techniques I can use to find what javascript is altering an HTML element? I am having some trouble finding how a particular element is getting an inline style of display:none added on load. I know I will find the script that does this eventually, but I want that process to be easier.

我的理想解决方案将是一些打破javascript执行的方法DOM元素被修改。我知道Chrome的开发工具能够右键单击一个元素,并选择Break On> Attribute Modifications。然而,这是在页面加载的某个时候发生的,所以如果我可以在所有其他脚本声明之前插入一些脚本,那么在修改一个类别为XYZ的元素之前插入一些脚本,并且在元素修改上断开JS执行,那将是非常好的。那么,JS执行会打破我可以看到修改元素的JS,或者也可以通过查看调用栈来找到,但是无论哪种方式,我都可以看到触发休息的脚本发生。我已经找到一些答案,告诉我如何使用Chrome开发工具/ Firebug,但像我所说,这个问题是关于程序化的方法。

My ideal solution would be some way of breaking javascript execution as soon as a DOM element is modified. I am aware of Chrome's dev tools ability to right click an element and select Break On > Attribute Modifications. However, this is happening sometime during page load, so it'd be really nice if I could insert some script before all other script declarations that says 'watch for an element with class XYZ' and break JS execution on element modification. Then, JS execution would either break where I can see the JS that modified the element, or perhaps that could be found by looking at the call stack, but either way, I would be able to see the script that triggered the break to happen. I have found some answers that tell me how to do that using Chrome dev tools / Firebug, but like I said, this question is about the programmatic approach.

推荐答案

右键单击DOM元素>中断>属性修改

Right click on DOM element > Break on > Attributes Modifications

通过#3在 http://www.elijahmanor.com/7- chrome-tips-developers-designer-may-not-know /

这篇关于查找正在更改DOM元素的javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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