Ok... I was able to confirm that, at least for the version of Safari I
have (1.3.2 on OSX.3.9), the eval.call(window,data) attempt at global
scope eval does not work.  I got some strange "Object (result of
expression testFunction) does not allow calls" error, where
"testFunction" was the function I was trying to define from an
external script file.  So I fixed it and I have what I believe to be
the final version of $.eval (or $.gEval as I'd prefer it).

jQuery.gEval = function(data){
        
window.execScript?window.execScript(data):jQuery.browser.safari?window.setTimeout(data,0):eval.call(
window, data );
}

or for readability's sake:

jQuery.gEval = function(data){
        if(window.execScript) // msie
                window.execScript(data);
        else if(jQuery.browser.safari) // safari
                window.setTimeout(data,0);
        else // all others
                eval.call( window, data );
}

What do you guys think? Works in all my tests so far, but again, I
don't have SVN access here so.... I'm SOL as far as the sweet new test
suite goes.

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to