This is to do with conditional compilation, an IE-only invention for varying JScript (IE's name for their flavour of ECMAScript) compilation based on information about the browser and environment. The syntax involves the @
symbol followed by a string to make up a variable, directive or statement. In this case, the presence of @TODO
directly after the start of a comment is causing the comment text to be interpreted as a conditional compilation statement, with @TODO
being a conditional compilation variable (with a value of NaN
: see http://msdn.microsoft.com/en-us/library/k0h7dyd7%28v=VS.80%29.aspx).
Conditional compilation statements are generally contained within JavaScript comments: these are there to prevent other browsers from attempting to interpret the code but are not in fact required to trigger conditional compilation. The MSDN documentation is here:
http://msdn.microsoft.com/en-us/library/ahx1z4fs%28v=VS.80%29.aspx
This feature is only enabled for code that appears after conditional compilation is enabled, which is achieved with
/*@cc_on @*/
Therefore if you can find this line and remove it then your //@TODO - report error
will be fine as it is. However, some of your code may rely on conditional compilation so this may not be an option. A workaround is to insert a space between the start of the comment (either //
or /*
) and the @
symbol:
// @TODO - report error
Microsoft's documentation is not clear enough to know why this works, since conditional compilation variables also work outside comments:
// The following works in IE:
/*@cc_on @*/
var j = @_jscript_build;
alert(j);
Therefore the safest option would be to avoid use of @TODO
altogether.