X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Ftransports%2Fscript.js;h=7416a2d1a99df09f53e0aeefd14f143b4ce4c0df;hb=dfa57073069c6b60f623635df65e02c0c0c9a582;hp=5470deccedcbce80453d1599d9dfe6045c6d3b74;hpb=ab3ba4a81252c4357a7aab5f24d765d41d47986e;p=jquery.git diff --git a/src/transports/script.js b/src/transports/script.js index 5470dec..7416a2d 100644 --- a/src/transports/script.js +++ b/src/transports/script.js @@ -47,10 +47,9 @@ jQuery.xhr.bindTransport("script", function(s) { script.src = s.url; // Attach handlers for all browsers - script.onload = script.onreadystatechange = function(statusText) { + script.onload = script.onreadystatechange = function( _ , statusText) { - if ( (!script.readyState || - script.readyState === "loaded" || script.readyState === "complete") ) { + if ( ! script.readyState || /loaded|complete/.test( script.readyState ) ) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; @@ -60,10 +59,10 @@ jQuery.xhr.bindTransport("script", function(s) { head.removeChild( script ); } - script = undefined; + script = 0; - // Callback & dereference - callback(statusText ? 0 : 200, statusText || "success"); + // Callback + callback( statusText ? 0 : 200, statusText || "success" ); } }; // Use insertBefore instead of appendChild to circumvent an IE6 bug. @@ -73,11 +72,11 @@ jQuery.xhr.bindTransport("script", function(s) { abort: function(statusText) { if ( script ) { - script.onload(statusText); + script.onload( 0 , statusText ); } } }; } }); -})(jQuery); +})( jQuery );