From a938d7b1282fc0e5c52502c225ae8f0cef219f0a Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Fri, 23 Nov 2012 10:29:08 -0500 Subject: No ticket: compress ajax. Close gh-1041. --- src/ajax/script.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/ajax/script.js') diff --git a/src/ajax/script.js b/src/ajax/script.js index ada74ff67..ac14c44be 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -4,7 +4,7 @@ jQuery.ajaxSetup({ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { - script: /javascript|ecmascript/ + script: /(?:java|ecma)script/ }, converters: { "text script": function( text ) { @@ -32,13 +32,13 @@ jQuery.ajaxTransport( "script", function(s) { if ( s.crossDomain ) { var script, - head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; + head = document.head || jQuery("head")[0] || document.documentElement; return { send: function( _, callback ) { - script = document.createElement( "script" ); + script = document.createElement("script"); script.async = true; @@ -57,12 +57,12 @@ jQuery.ajaxTransport( "script", function(s) { script.onload = script.onreadystatechange = null; // Remove the script - if ( head && script.parentNode ) { - head.removeChild( script ); + if ( script.parentNode ) { + script.parentNode.removeChild( script ); } // Dereference the script - script = undefined; + script = null; // Callback if not abort if ( !isAbort ) { @@ -70,14 +70,15 @@ jQuery.ajaxTransport( "script", function(s) { } } }; - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709 and #4378). + + // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending + // Use native DOM manipulation to avoid our domManip AJAX trickery head.insertBefore( script, head.firstChild ); }, abort: function() { if ( script ) { - script.onload( 0, 1 ); + script.onload( undefined, true ); } } }; -- cgit v1.2.3