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;
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.
abort: function(statusText) {
if ( script ) {
- script.onload(statusText);
+ script.onload( 0 , statusText );
}
}
};