Karl Rudd wrote: > > // window.setTimeout(s,0); // blah() fails in all > Karl Rudd >
This is very surprising. I tested the setTimeout before posting Jeff's installScript to this thread, and I found that it worked. But my test was inappropriate, because I wanted it to succeed with my getScript issue, while you wanted it to fail in general and your attitude is much better than mine, for testing something. So this is just to confirm that your claiming about setTimeout is correct. Here are the results of my new testing session, using a case very similar to yours: The setTimeout works never in Opera, and some times does, other does not in Firefox. Here are the details: fresh cache % is subjective IE + head call: 1st alert: good - 2nd alert: good IE + body call: 1st alert: good - 2nd alert: good FF + head call + eval.call: 1st alert: good - 2nd alert: good FF + body call + eval.call: 1st alert: good - 2nd alert: good Op + head call + eval.call: 1st alert: good - 2nd alert: good Op + body call + eval.call: 1st alert: good - 2nd alert: good FF + head call + setTimeout + go: 1st alert: bad - 2nd alert: 90% bad FF + head call + setTimeout + refresh: 1st alert: bad - 2nd alert: 60% bad FF + body call + setTimeout + go: 1st alert: bad - 2nd alert: 60% bad FF + body call + setTimeout + refresh: 1st alert: bad - 2nd alert: 60% bad Op + head call + setTimeout: 1st alert: bad - 2nd alert: bad Op + body call + setTimeout: 1st alert: bad - 2nd alert: bad And here is the script used for testing: function jQuery_eval( script ) { if (!script) return; if (window.execScript) window.execScript( script ); else { eval.call( window, script ); // window.setTimeout( script, 0 ); } } var global = "not changed"; function hereScript( fn ) { var re = new RegExp( "function\\s*\\(\\s*\\)\\s*\\{((?:.|\\n)*)\\}", "g" ); return re.exec( fn )[1]; } var script = hereScript( function() { //------------------------------------- function blah2() { alert( "hello from blah2()" ); } global = "changed"; //------------------------------------- } ); //alert( script ); function test() { jQuery_eval( script ); alert( global ); try { blah2(); } catch( e ) { alert( e ); } } //test(); -- View this message in context: http://www.nabble.com/getScript-error-tf2652417.html#a7508366 Sent from the JQuery mailing list archive at Nabble.com. _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/