Hi again, Jörn: It looks like you went ahead and implemented the $.eval() function in ajax.js. Cool! Thanks! However, I do have 1 more point besides the Safari problem I mentioned above:
In most modern browsers (IE Excluded of course), the built in eval function is defined on all objects. This is designed to combat the problem we're trying to fix now, which is that you can eval code in specific context (in FF for examle) by just calling myObj.eval(codeString);. However, we've had to resort to all sorts of things to get around Safari and IE. However, I'm afraid there may be unintended consequences if we use the name eval for our x-browser implementation of global eval because in some browsers I believe that eval will be called implicitly on "this" in it's current context. This would call $.eval implicitly at certain times and in certain browsers when we don't expect it, which could possibly override global variables or functions which we also aren't expecting. So my proposal above of $.geval() for "global eval" was intended to avoid this possibility. I may be being paranoid, but I can imagine that a bug that involved eval being unexpectedly global might be very hard to track down. Thanks again Jörn, Paul On 11/21/06, Paul McLanahan <[EMAIL PROTECTED]> wrote: > Cool.. Didn't know that. I do know that the reason that the > window.setTimeout function is used is that Safari doesn't obey the > eval.call context, but it does eval scripts in setTimeout globally. > So we'll have to do a little more browser detection to get it done > exactly right. I'll see what I can code up when I get off work. > > Thanks Jörn > > On 11/21/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: > > Using window.setTimeout introduces a new problem: The evaluation is > > asynchronous. According to an Opera resource, the minimal timeout that > > browsers can handle is 10ms, therefore you can't rely on the evaluation > > being ready when executing code after the window.setTimeout call. I'd > > stick with eval.call( window, data) for jQuery's ajax module. > _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
