是否可以检测何时设置内联样式属性? [英] Is it possible to detect when an inline style property was set?

查看:153
本文介绍了是否可以检测何时设置内联样式属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个bug,其中某个div的style.height属性被设置为0px的Javascript,但我不知道什么代码做这个不必要的设置。

I have a bug where a certain div is having its style.height property being set to 0px by Javascript but I have no idea what code is doing this unwanted setting.

当设置inline height属性时,是否告诉调试器停止执行,或者在这种情况下至少有一个事件触发?

问题出现在一个棘手的内部循环中,我不想要手动二进制搜索,除非我真的必须。 (特别是因为有可能来自事件或超时的罪魁祸首的代码可能会更加难以准确)

The problem is occurring in a thorny inner loop and I don't want to have to do a manual "binary search" unless I really have to. (Specially since there is a chance that the culprit code could be coming from an event or timeout and that would be harder to pinpoint by hand)

编辑:我还需要在将有关元素插入主文档之前,可以做到这一点。当我可以对元素标签进行检查时,错误已被触发。

I also need to be able to do this before the element in question is inserted into the main document. By the time I can do to the elements tab to inspect it the bug has already been triggerred.

推荐答案

在元素选项卡中Chrome开发工具,我相信您可以右键单击元素,应该有一个选项来修改属性。

In the Elements tab of Chrome Dev Tools, I believe you can right click on the element and there should be an option to "Break on attribute modification".

https://developers.google.com/chrome-developer-tools/docs/scripts-breakpoint#dom

这篇关于是否可以检测何时设置内联样式属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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