From 78db847ef201a66f88e9ad330b2e51c65c58abb3 Mon Sep 17 00:00:00 2001 From: John Resig Date: Fri, 20 Jul 2007 19:33:44 +0000 Subject: [PATCH] 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). --- src/ajax/ajax.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index 65ae119f..d72ddc6b 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 ); + } } });