aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax/script.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2012-11-23 10:29:08 -0500
committerRichard Gibson <richard.gibson@gmail.com>2012-11-25 13:07:46 -0500
commita938d7b1282fc0e5c52502c225ae8f0cef219f0a (patch)
treee65720e5c0ab9c55690cabf16f0a7423c1c2daa7 /src/ajax/script.js
parentc27dc018e22260b6ad084dff4505172e6b107178 (diff)
downloadjquery-a938d7b1282fc0e5c52502c225ae8f0cef219f0a.tar.gz
jquery-a938d7b1282fc0e5c52502c225ae8f0cef219f0a.zip
No ticket: compress ajax. Close gh-1041.
Diffstat (limited to 'src/ajax/script.js')
-rw-r--r--src/ajax/script.js19
1 files changed, 10 insertions, 9 deletions
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 );
}
}
};