Hello,
Just wanted to send everyone a heads up as it looks like there's an
issue when using EJS and viewing a site in IE9 beta 1. The following
error appears:
SCRIPT16389: error -
2147467259
I've tracked down the issue and it looks like the following bit of
code is the problem:
file: ejs.js - function EJS.Compiler.compile - line: 356 (specifically
line 365)
try{
eval(to_be_evaled);
}catch(e){
if(typeof JSLINT != 'undefined'){
JSLINT(this.out);
for(var i = 0; i < JSLINT.errors.length; i++){
var error = JSLINT.errors[i];
if(error.reason != "Unnecessary semicolon."){
error.line++;
var e = new Error(); // NOTE: this is true culprit
e.lineNumber = error.line;
e.message = error.reason;
if(options.view)
e.fileName = options.view;
throw e;
}
}
}else{
throw e;
}
}
}
From what I can tell, IE9 beta 1 does not allow you to assign a new
object to the same variable used in the catch statement. The obvious
workaround is to do something like this:
var ex = new Error(); // NOTE: rename the variable
ex.lineNumber = error.line;
ex.message = error.reason;
if(options.view)
ex.fileName = options.view;
throw ex;
I think this is more of an IE9 issue than an EJS issue as previous
versions of IE supported this with no problem, but I figured I'd post
it here anyways, just in case anyone else runs into it.
-Nate