Firebug - Debugging script loaded dynamically

我与影子孤独终老i 提交于 2019-12-23 18:03:23

问题


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'.


回答1:


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;

And Firebug should happily break at the line where debugger is inserted.


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

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.



来源:https://stackoverflow.com/questions/7188245/firebug-debugging-script-loaded-dynamically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!