I’m using jsio (jslibs – http://code.google.com/p/jslibs/wiki/jsio) and am running into a bug on Safari. Unexpected token ‘=’
The problem is with this part of the code.
this.debugPath = function(path) { return path; }
// IE6 won't return an anonymous function from eval, so use the function constructor instead
var rawEval = (typeof eval('(function(){})') == 'undefined')
? function(src, path) { return (new Function('return ' + src))(); }
: function(src, path) { var src = src + '\n//@ sourceURL=' + path; return window.eval(src); };
// provide an eval with reasonable debugging
this.eval = function(code, path, origCode) {
......................
The problem seems to be at the line where rawEval is being assigned. Commenting it out caused the error to shift elsewhere. Has anyone encountered this problem before?
Help?
Thanks.
This is for future reference if anyone (including me) runs into this problem again.
The error that Safari throws in my case is spurious or at the least pretty ambiguous.
I had defined a class in one of my libraries. And I didn’t want to store a handle/reference to an object of that class. So, I’d done something like:
When I changed it to the following, Safari stopped complaining.
Declaring a new object and defining one of its member properties (or functions) could be a problem.