[英]Understanding unreachable breakpoints in IE11 F12 Developer tools
I have an issue I'm trying to debug on our website, where a particular javascript routine is not being found. 我有一个问题,我正在尝试在我们的网站上调试,其中没有找到特定的JavaScript例程。 I'm at a loss to identify why, but my thinking is that if the F12 Dev tools can't reach the code for some reason, then anything in that script block is inaccessible and will not be executed.
我无法确定原因,但我的想法是,如果F12 Dev工具由于某种原因无法访问代码,那么该脚本块中的任何内容都将无法访问且无法执行。
Is there somewhere I can look to for an explanation of why code in one script block is reachable, and another, seemingly identical block is unreachable? 有什么地方我可以寻找解释为什么一个脚本块中的代码可以访问,另一个看似相同的块是无法访问的?
replace with language="javascript"
or remove language="JavaScript"
替换为
language="javascript"
或删除language="JavaScript"
As per https://msdn.microsoft.com/en-us/library/ms533940(v=vs.85).aspx for attribute language. 根据https://msdn.microsoft.com/en-us/library/ms533940(v=vs.85).aspx的属性语言。
javascript
JavaScript的
Script is JavaScript.
脚本是JavaScript。
Although I awarded the bounty to the first post, the actual answer is that an error in the second block of javascript invalidates the entire block for breakpoint handling. 虽然我将奖金授予了第一篇文章,但实际答案是第二个javascript块中的错误使整个块无效以进行断点处理。
To diagnose this (if the code isn't your own, or you wrote it a long time ago and have forgotten where you made changes) is to break each routine into its own separate block, then find the block that is still failing. 要诊断这个(如果代码不是您自己的,或者您很久以前编写它并且忘记了更改的位置)是将每个例程分解为它自己的单独块,然后找到仍然失败的块。 Then, go through that routine with a fine-toothed comb to determine the cause of the syntax failure -- be thorough!
然后,使用细齿梳子完成该例程,以确定语法失败的原因 - 彻底!
Once I identified the cause (a misplaced semicolon), then breakpoints were re-enabled for the entire block. 一旦我确定了原因(错误的分号),就会为整个块重新启用断点。
Other causes could be that the code block is unreachable, due to duplicate function names. 其他原因可能是由于重复的函数名称,代码块无法访问。 That wasn't my case, however, so I didn't confirm this as a possible cause of unreachable breakpoints.
然而,这不是我的情况,所以我没有证实这是可能导致无法到达的断点的原因。
It seems like the function positionCollectionList() call is returning in the end and the next block of code in your case strDGLabel_ContributingFactors hadn't been enclosed in any function so that it can't be called or executed which means it is unreachable code. 似乎函数positionCollectionList()调用最后返回,并且你的案例中的下一个代码块strDGLabel_ContributingFactors没有被包含在任何函数中,因此无法调用或执行它,这意味着它是无法访问的代码。
For making sure you can try the following example 为确保您可以尝试以下示例
Try to save the below code as a html file and open it in IE and then try to keep a breakpoint at line 8 you will reproduce the issue. 尝试将以下代码保存为html文件并在IE中打开它,然后尝试在第8行保留断点,您将重现该问题。
<html>
<script>
var te;
</script>
<script>
var test="testing";
return;
te="test";
</script>
<body>
HI
</body>
</html>
Thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.