aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax/ajax.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2007-07-20 19:33:44 +0000
committerJohn Resig <jeresig@gmail.com>2007-07-20 19:33:44 +0000
commit78db847ef201a66f88e9ad330b2e51c65c58abb3 (patch)
tree9de463f563a43c8134e112f90c583a59cc48335f /src/ajax/ajax.js
parentf267cfaedf9f01ddf1f6f9c214ea07906c01a84a (diff)
downloadjquery-78db847ef201a66f88e9ad330b2e51c65c58abb3.tar.gz
jquery-78db847ef201a66f88e9ad330b2e51c65c58abb3.zip
The isTimeout fix from #970 was causing unintended status bugs (fixed). This also includes a fix for errors that occurred during an empty eval in IE (but #1410).
Diffstat (limited to 'src/ajax/ajax.js')
-rw-r--r--src/ajax/ajax.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index 65ae119f1..d72ddc6b7 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -655,8 +655,10 @@ jQuery.extend({
var status;
try {
- status = isTimeout || (jQuery.httpSuccess( xml ) ?
- s.ifModified && jQuery.httpNotModified( xml, s.url ) ? "notmodified" : "success" : "error");
+ status = isTimeout == "timeout" && "timeout" ||
+ !jQuery.httpSuccess( xml ) && "error" ||
+ s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" ||
+ "success";
// Make sure that the request was successful or notmodified
if ( status != "error" && status != "timeout" ) {
// Cache Last-Modified header, if ifModified mode.
@@ -826,13 +828,16 @@ jQuery.extend({
// 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 );
+ data = jQuery.trim( data );
+ if ( 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 );
+ }
}
});