X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Ftransports%2Fscript.js;h=0db0de6c7ef7d56dfc4047018028efd870a249a8;hb=e56de77df90e50b9999a02e57241b1cf498b0fe4;hp=7416a2d1a99df09f53e0aeefd14f143b4ce4c0df;hpb=dfa57073069c6b60f623635df65e02c0c0c9a582;p=jquery.git diff --git a/src/transports/script.js b/src/transports/script.js index 7416a2d..0db0de6 100644 --- a/src/transports/script.js +++ b/src/transports/script.js @@ -6,34 +6,34 @@ jQuery.extend( true, jQuery.ajaxSettings , { accepts: { 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 ) { s.cache = false; } - + // This transport only deals with cross domain get requests if ( s.crossDomain && s.async && ( s.type === "GET" || ! s.data ) ) { - + s.global = false; - + var script, head = document.getElementsByTagName("head")[0] || document.documentElement; - + return { - + send: function(_, callback) { script = document.createElement("script"); @@ -43,24 +43,24 @@ jQuery.xhr.bindTransport("script", function(s) { if ( s.scriptCharset ) { script.charset = s.scriptCharset; } - + script.src = s.url; - + // Attach handlers for all browsers script.onload = script.onreadystatechange = function( _ , statusText) { - + if ( ! script.readyState || /loaded|complete/.test( script.readyState ) ) { - + // Handle memory leak in IE script.onload = script.onreadystatechange = null; - + // Remove the script if ( head && script.parentNode ) { head.removeChild( script ); } - + script = 0; - + // Callback callback( statusText ? 0 : 200, statusText || "success" ); } @@ -69,7 +69,7 @@ jQuery.xhr.bindTransport("script", function(s) { // This arises when a base node is used (#2709 and #4378). head.insertBefore( script, head.firstChild ); }, - + abort: function(statusText) { if ( script ) { script.onload( 0 , statusText );