Merge branch 'master' of github.com:jquery/jquery into deferred
authorjaubourg <j@ubourg.net>
Thu, 30 Dec 2010 03:43:31 +0000 (04:43 +0100)
committerjaubourg <j@ubourg.net>
Thu, 30 Dec 2010 03:43:31 +0000 (04:43 +0100)
1  2 
src/transports/script.js

diff --combined src/transports/script.js
@@@ -7,17 -7,17 +7,17 @@@ jQuery.extend( true, jQuery.ajaxSetting
                script: "text/javascript, application/javascript"
        },
        
 -      autoDataType: {
 +      contents: {
                script: /javascript/
        },
                
 -      dataConverters: {
 -              "text => script": jQuery.globalEval
 +      converters: {
 +              "text script": jQuery.globalEval
        }
  } );
  
  // Bind script tag hack transport
 -jQuery.xhr.bindTransport("script", function(s) {
 +jQuery.ajax.transport("script", function(s) {
        
        // Handle cache special case
        if ( s.cache === undefined ) {
                                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.
@@@ -73,7 -72,7 +72,7 @@@
                        
                        abort: function(statusText) {
                                if ( script ) {
-                                       script.onload(statusText);
+                                       script.onload( 0 , statusText );
                                }
                        }
                };