Does IE have more strict Javascript parsing than Chrome?

Posted by Clay Shannon on Programmers See other posts from Programmers or by Clay Shannon
Published on 2013-08-09T19:20:23Z Indexed on 2013/11/11 4:12 UTC
Read the original article Hit count: 220

This is not meant to start a religio-technical browser war - I still prefer Chrome, at least for now, but:

Because of a perhaps Chrome-related problem with my web page (see https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=&id=161473), I temporarily switched to IE (10) to see if it would also view the time value as invalid.

However, I didn't even get to that point - IE stopped me in my tracks before I could get there; but I found that IE was right - it is more particular/precise in validating my code. For example, I got this from IE:

SCRIPT5007: The value of the property '$' is null or undefined, not a Function object 

...which was referring to this:

<script src="/CommonLogin/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
    // body sometimes becomes white???? with jquery 1.6.1
    $("body").css("background-color", "#405DA7");
<

This line is highlighted as the culprit:

$("body").css("background-color", "#405DA7");

jQuery is referenced right above it - so why did it consider "$" to be undefined, especially when Chrome had no problem with it...ah! I looked at that location (/CommonLogin/Scripts/) and saw that, sure enough, the version of jQuery there was actually jquery-1.6.2.min.js. I added the updated jQuery file (1.9.1) and it got past this.

So now the question is: why does Chrome ignore this? Does it download the referenced version from its own CDN if it can't find it in the place you specify?

IE did flag other errs after that, too; so I'm thinking perhaps IE is better at catching lurking problems than, at least, Chrome is. Haven't tested Firefox diesbzg yet.

© Programmers or respective owner

Related posts about jQuery

Related posts about browser