使Firebug内部动态加载javascript [英] Making Firebug break inside dynamically loaded javascript

查看:123
本文介绍了使Firebug内部动态加载javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来调试动态加载的jQuery document.ready函数。

I'm looking for a way to debug a dynamically loaded jQuery document.ready function.

显然我不能只调出脚本面板并用鼠标添加断点,因为那里没有该函数。

Obviously I can't just bring up the script panel and add a breakpoint with the mouse since the function does not exist there.

我也试过添加调试器;功能(没有引号),但没有做任何事情。我已经确保在我尝试这个时实际执行了该功能。

I've also tried adding "debugger;" to the function (without the quotes), but that did not do anything. I have ensured that the function is actually executed while I tried this.

感谢您的帮助,

Adrian

编辑:我刚刚注意到Firebug实际上在调试中断了。但是,当它在动态加载的脚本上执行此操作时,它不像往常那样显示该脚本的源代码。另外,调用堆栈在我自己的代码下面结束。我可以通过调用堆栈调出document.ready的实现,但这并没有真正帮助。这是一个Firebug错误还是我错过了什么?

I just noticed that Firebug actually breaks on debug. However, when it does so on a dynamically loaded script, it does not bring up the source code of that script as usual. Plus, the call stack ends right below my own code. I can bring up the implementation for document.ready via the call stack, but that does not really help. Is this a Firebug bug or have I missed something?

推荐答案

我刚刚处理了这个类似的问题。解决方案包括两次添加调试器一词;一次位于外部文件的顶部,再一次位于需要调试的函数顶部。

I just worked on this similar question. The solution involves adding the word debugger twice; once at the top of the external file and one more time at the top of the function that needs to be debugged.

我注意到如果调试器单词只使用一次, 那没起效。示例:

I noticed that if the debugger word was used only once, it did not work. Example:

//myExternal.js
debugger;
function myExternalFunction(){
 debugger;
 /* do something here */
}

这篇关于使Firebug内部动态加载javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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