diff options
Diffstat (limited to 'js/vendor/jquery/src/ajax/script.js')
-rw-r--r-- | js/vendor/jquery/src/ajax/script.js | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/js/vendor/jquery/src/ajax/script.js b/js/vendor/jquery/src/ajax/script.js index f44329d4e..945bea9da 100644 --- a/js/vendor/jquery/src/ajax/script.js +++ b/js/vendor/jquery/src/ajax/script.js @@ -1,15 +1,17 @@ -define([ +define( [ "../core", + "../var/document", "../ajax" -], function( jQuery ) { +], function( jQuery, document ) { // Install script dataType -jQuery.ajaxSetup({ +jQuery.ajaxSetup( { accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" }, contents: { - script: /(?:java|ecma)script/ + script: /\b(?:java|ecma)script\b/ }, converters: { "text script": function( text ) { @@ -17,7 +19,7 @@ jQuery.ajaxSetup({ return text; } } -}); +} ); // Handle cache's special case and crossDomain jQuery.ajaxPrefilter( "script", function( s ) { @@ -27,20 +29,20 @@ jQuery.ajaxPrefilter( "script", function( s ) { if ( s.crossDomain ) { s.type = "GET"; } -}); +} ); // Bind script tag hack transport jQuery.ajaxTransport( "script", function( s ) { + // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, callback; return { send: function( _, complete ) { - script = jQuery("<script>").prop({ - async: true, + script = jQuery( "<script>" ).prop( { charset: s.scriptCharset, src: s.url - }).on( + } ).on( "load error", callback = function( evt ) { script.remove(); @@ -50,6 +52,8 @@ jQuery.ajaxTransport( "script", function( s ) { } } ); + + // Use native DOM manipulation to avoid our domManip AJAX trickery document.head.appendChild( script[ 0 ] ); }, abort: function() { @@ -59,6 +63,6 @@ jQuery.ajaxTransport( "script", function( s ) { } }; } -}); +} ); -}); +} ); |