Fix for #7865. Scripts onload handler passes event as first parameter so statusText is now passed as second argument for aborts.

This commit is contained in:
jaubourg 2010-12-30 04:41:52 +01:00
parent 5fd21fc02b
commit dfa5707306

View file

@ -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,9 +59,9 @@ jQuery.xhr.bindTransport("script", function(s) {
head.removeChild( script );
}
script = undefined;
script = 0;
// Callback & dereference
// Callback
callback( statusText ? 0 : 200, statusText || "success" );
}
};
@ -73,7 +72,7 @@ jQuery.xhr.bindTransport("script", function(s) {
abort: function(statusText) {
if ( script ) {
script.onload(statusText);
script.onload( 0 , statusText );
}
}
};