diff options
author | jaubourg <j@ubourg.net> | 2010-12-30 04:43:31 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2010-12-30 04:43:31 +0100 |
commit | 64902e03450dc9164dbdb046a701008a249497c1 (patch) | |
tree | faba8ad4d581c17f112e03b82e3e197d6066215b | |
parent | 7490eb4f8e1930ca370eec21b4d5469f87b65db6 (diff) | |
parent | dfa57073069c6b60f623635df65e02c0c0c9a582 (diff) | |
download | jquery-64902e03450dc9164dbdb046a701008a249497c1.tar.gz jquery-64902e03450dc9164dbdb046a701008a249497c1.zip |
Merge branch 'master' of github.com:jquery/jquery into deferred
-rw-r--r-- | src/transports/script.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/transports/script.js b/src/transports/script.js index 57a896d75..d18f4d76e 100644 --- a/src/transports/script.js +++ b/src/transports/script.js @@ -47,10 +47,9 @@ jQuery.ajax.transport("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.ajax.transport("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,7 +72,7 @@ jQuery.ajax.transport("script", function(s) { abort: function(statusText) { if ( script ) { - script.onload(statusText); + script.onload( 0 , statusText ); } } }; |