我如何追踪JavaScript对DOM的变更? [英] How can i trace changes made to the DOM by JavaScript?

查看:208
本文介绍了我如何追踪JavaScript对DOM的变更?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大型网站在开发与大量的JS在不同的文件。我遇到一个问题,即从DOM中删除一个类。我可以看到它,当我查看源,但不是在Firebug。

I have a large website in development with a large amount of JS in different files. I have come across an issue where something is removing a class from the DOM. I can see it when I view source but not in Firebug.

通常我会放置一些alert / console.log调用hasClass值,但因为我不知道在哪里开始我想知道当它发生某种变化时是否可以跟踪更改?

Normally I would place some alerts/console.log calls with the hasClass value but because I have no idea where to start I wanted to know if I can trace the change back when it occurs somehow?

Denis

推荐答案

Firebug可让您设置断点并单步执行代码 。这应该清楚问题发生在哪里。

Firebug lets you set a breakpoint and single-step through your code. This should make it clear where the issue is happening.

这篇关于我如何追踪JavaScript对DOM的变更?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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