Firebug - 动态加载的调试脚本 [英] Firebug - Debugging script loaded dynamically
问题描述
使用jQuery UI选项卡我加载包含JavaScript代码的页面。
有没有办法使用Firebug来调试该代码?然后在firebug的'Scripts'选项卡中看不到,显示'all','static,eval和event'。
Using jQuery UI tabs I load pages which contain JavaScript code. Is there any way using Firebug to debug that code? Can't see then in the 'Scripts' tab of firebug, showing 'all', 'static, eval and event'.
推荐答案
您可以使用关键字调试器
。我相信它也适用于基于WebKit的浏览器的Web Inspector。因此,举例来说,你可以这样做:
You can, with the keyword debugger
. I believe it also works with Web Inspector for WebKit-based browsers. So, for example, you can do something like this:
a = 1;
debugger;
a = 2;
Firebug应该很高兴在调试器$ c $的行中断c>已插入。
And Firebug should happily break at the line where debugger
is inserted.
与往常一样,SO上有几个类似的问题:
There have been several similar questions on SO, as usual:
- dynamically loaded js function does not appear in Firebug js debugger
- Making Firebug break inside dynamically loaded javascript
我有一个体验旧版本的firebug / firefox,它不能很好地处理调试器
关键字。它暂停了JavaScript执行,但没有显示脚本的正确位,这有点无用。但是我仍然可以使用控制台来访问DOM对象和变量,以及盲目地逐步执行它。
I had an experience with an older version firebug/firefox where it did not cope well with the debugger
keyword. It paused the JavaScript execution all right, but did not show the correct bits of the script, which was kind of useless. But I could still use the console to access the DOM objects and variables, as well as stepping through it blindly.
这篇关于Firebug - 动态加载的调试脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!