避免在 Chrome 开发者工具中单步执行 javascript 文件?
我想知道,有没有办法从 Chrome 开发者工具调试器中省略 javascript 文件,这样它就会自动跳过对该脚本进行的任何函数调用?
我问这个问题是因为我的项目经常包含大型库,例如 jQuery。当我在调试时在 Chrome 开发人员工具中单步执行 javascript 时,每次在脚本中进行 jQuery 调用时都必须单步执行 jQuery 的 lib。
我最终不得不在每次调用 jQuery 对象后在一行设置断点。这是我发现跳过的唯一方法,而且非常烦人。
I am wondering, is there any way to omit a javascript file from Chrome Developer Tools debugger, so it will automatically skip over any function calls made to that script?
I ask because my projects often include large libraries such as jQuery. When I step through javascript in Chrome Developer Tools while debugging, I have to step through jQuery's lib every time I make a jQuery call in my script.
I end up having to set breakpoints one line after every call to the jQuery object. It's the only way I have found to skip past and it's very annoying.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
更新2
在最新版本的 Chrome 中,此功能的用户流程得到了改进。请参考 https://developer.chrome.com/devtools/docs/blackboxing
<强>更新1
从 Chrome 版本 38 开始,您不再需要启用开发者工具实验。
以下详细信息仅用于历史记录
现在在 chrome 版本 30+ 中可以实现这一点。
启用框架调试支持
。 (您可能还想尝试在调试时显示步入候选
)来源:提示和技巧:在 Chrome 中调试时忽略库代码
UPDATE 2
There has been an improvement in user flow of this feature in latest versions of chrome. Please refer to https://developer.chrome.com/devtools/docs/blackboxing
UPDATE 1
Since Chrome version 38, you no longer have to enable Developer Tools experiments.
Below details are only for history
This is possible now in chrome version 30+.
chrome://flags/#enable-devtools-experiments
. (Yes, you need to type that where you type the URL)Enable frameworks debugging support
. (You also might want to tryShow step-in candidates while debugging
)Source: Tips and Tricks: Ignoring library code while debugging in Chrome
iSid 我想指出的是,从 Chrome 38 开始,您不再需要启用 devtools 实验。相反,如果您直接进入 F12 开发人员工具 ->设置->一般->来源,您将看到其中的最后一项是管理框架黑盒。好的部分是您可以在自己的线路上设置每个框架,或者您可以将通用的捕获所有模式放在一起,例如 (firebug|angular|knockout|jquery|bootstrap|modernizr|respond)
iSid I would like to point out that as of Chrome 38 you no longer need to enable the devtools experiments. Instead if you go straight to the F12 developer tools -> settings -> general -> sources you will see the last item in there is manage framework blackboxing. The good part is you can setup each framework on it's own line or you can throw together a generic catch all pattern like (firebug|angular|knockout|jquery|bootstrap|modernizr|respond)
版本 51 中的情况略有不同。
按 F12,然后按 F1。从左侧菜单中选择“黑盒”。
Things are a little bit different in the version 51.
Press F12 then F1. Pick 'Blackboxing' from the menu on the left.
在 Chrome v68 下,在 .js 文件上调试时,使用左键单击黑盒脚本:
https:// /developer.chrome.com/devtools/docs/blackboxing
Under Chrome v68, while debugging on a .js file, use left click to blackbox script:
https://developer.chrome.com/devtools/docs/blackboxing
“Step Out”按钮可用于快速退出 JQuery 代码。
The "Step Out" button can be used to quickly get you out of the JQuery code.