开发者

Firebug fails to load js file

I've noticed that a syntax error in JS file sometimes causes that js file not to be listed in Script 开发者_StackOverflow社区Firebug tab at all.

I'm pretty sure that Firebug is supposed to help finding such errors instead of excluding the entire js file.

What am I missing?

Thanks v.

Firefox 3.6.13

Firebug 1.6.0

EDIT: Below's the example of the code that breaks it. The closing parenthesis was left on the $.each line, before instead after the function body. Now that I've experimented a bit, it appears to be somewhat inconsistent in behavior, but the bottom line is that the only error that gets reported is " is not defined", when another function defined in the erroneous file is called.

function aaa(){
    var sum = 0;
    $.each([1, 2, 3], function(i, val)){
        sum += val;
    };
    return sum;
}


I just found out, the same error i got was happening on the following line:

selectOptionNode.value = current);

it is a leftover parantheses which has no corresponding start parantheses. So this seems to be a reason for firebug to not load the whole script and never tell about it. Weird...

removing the paranthesis fixed the problem.


OK. As people don't find this interesting, I can put in some hints. Hopefully they help someone:

  1. Try reloading page twice to make sure that new version of external js file is loaded.
  2. FF/FB have memory issues that most of us have experienced. Restarting FF could also help.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜