[jQuery] Why globalEval?
[jQuery] Why globalEval?
I was just reading through some of the jQuery code again to better learn its
internals, and I'm not sure why the globalEval function exists in its current
form.
Whenever I want to eval something in the global context, I always do:
Function(data)();
since the Function constructor doesn't create a closure. This seems much
simpler than the current logic, expecially for Safari - but I admit that I
haven't done much cross-browser checking. Do some browsers not support the
above syntax, or is there some other reason for using the long globalEval
logic?
Matt Kruse
matt@mattkruse.com
http://www.mattkruse.com/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/