I came across an error / undocumented function in IE 7, 6.5 (maybe others?). This does not affect Opera (10.5x) Firefox (3.5.x) or, possibly, any other browser (that's all I have tested so far). This does not seem to be a Javascript documented ability.
Including a comment indicated by double slashes and immediately followed by a double ( //@@) sign , the entire file .jsis useless. I checked several options, and here is what I found (where fail = JS is not loaded, pass = JS is loaded):
- fail:
//@@ - fail:
//@ @ - fail:
//@@@- any number @ does not seem to change - fail:
//@@ text- any subsequent content does not help - fail:
//@hello@- any content between @ does not help - pass:
// @@ - pass:
// @ @- the space in front of the first @ character will interfere - pass:
//hello @@- any content before the first @ seems to prevent - pass:
/*@@*/- applies only to comment style//
IE 7 - simply ignores the file, when trying to refer to the contents of this file, an error appears in the line " <function/object> is undefined". IE6.5 has the integrity of reporting " Invalid character", which greatly improves your ability to find a problem!
And so the question is : Does anyone know why this is happening and what is happening?
You can work with it (insert a space, use a different style of comments, etc.), but it is worth noting the problem there, since debugging can be time-consuming.
UPDATE:
How to play:
Source: flaw.ie.html
<html lang="en">
<head>
<title>Test</title>
<script src="turnon.cc.js"></script>
<script src="flaw.ie.js"></script>
</head>
<body>
World
</body>
</html>
: flaw.ie.js
alert('hello');
: turnon.cc.js
:
IE: : World
FF/Opera: Alert: ! : World
: IE , .