aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2006-12-02 13:43:02 +0000
committerJörn Zaefferer <joern.zaefferer@gmail.com>2006-12-02 13:43:02 +0000
commit39c05d36493f215155cf446f7d879d3bc96ac2f7 (patch)
treee9c2a0a2efd21c51d1c1c0867e890fa54e4dcc8e /src/ajax
parentef1ee513d314123017fce770e8fe0a9c85b9eb87 (diff)
downloadjquery-39c05d36493f215155cf446f7d879d3bc96ac2f7.tar.gz
jquery-39c05d36493f215155cf446f7d879d3bc96ac2f7.zip
Fixed jQuery.eval (or rather, jQuery.globalEval to avoid problems with FF)
Diffstat (limited to 'src/ajax')
-rw-r--r--src/ajax/ajax.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index 73eba22b1..d56ae0f1e 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -124,7 +124,7 @@ jQuery.fn.extend({
// for some weird reason, it doesn't work if the callback is ommited
jQuery.getScript( this.src );
else {
- jQuery.eval ( this.text || this.textContent || this.innerHTML || "" );
+ jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" );
}
}).end();
}
@@ -304,6 +304,10 @@ jQuery.extend({
* Loads, and executes, a remote JavaScript file using an HTTP GET request.
* All of the arguments to the method (except URL) are optional.
*
+ * Warning: Safari <= 2.0.x is unable to evalulate scripts in a global
+ * context sychronously. If you load functions via getScript, make sure
+ * to call them after a delay.
+ *
* @example $.getScript("test.js")
*
* @example $.getScript("test.js", function(){
@@ -684,7 +688,7 @@ jQuery.extend({
// If the type is "script", eval it in global context
if ( type == "script" ) {
- jQuery.eval( data );
+ jQuery.globalEval( data );
}
// Get the JavaScript object, if JSON is used.
@@ -727,10 +731,14 @@ jQuery.extend({
return s.join("&");
},
- // TODO document me
- eval: function(data) {
+ // evalulates a script in global context
+ // not reliable for safari
+ globalEval: function(data) {
if (window.execScript)
window.execScript( data );
+ else if(jQuery.browser.safari)
+ // safari doesn't provide a synchronous global eval
+ window.setTimeout( data, 0 );
else
eval.call( window, data );
}