Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libs/bower_components/jquery/src/ajax/script.js')
-rw-r--r--libs/bower_components/jquery/src/ajax/script.js83
1 files changed, 29 insertions, 54 deletions
diff --git a/libs/bower_components/jquery/src/ajax/script.js b/libs/bower_components/jquery/src/ajax/script.js
index f6598aaf3d..945bea9dae 100644
--- a/libs/bower_components/jquery/src/ajax/script.js
+++ b/libs/bower_components/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,77 +19,50 @@ jQuery.ajaxSetup({
return text;
}
}
-});
+} );
-// Handle cache's special case and global
+// Handle cache's special case and crossDomain
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
- s.global = false;
}
-});
+} );
// Bind script tag hack transport
-jQuery.ajaxTransport( "script", function(s) {
+jQuery.ajaxTransport( "script", function( s ) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
-
- var script,
- head = document.head || jQuery("head")[0] || document.documentElement;
-
+ var script, callback;
return {
-
- send: function( _, callback ) {
-
- script = document.createElement("script");
-
- script.async = true;
-
- if ( s.scriptCharset ) {
- script.charset = s.scriptCharset;
- }
-
- script.src = s.url;
-
- // Attach handlers for all browsers
- script.onload = script.onreadystatechange = function( _, isAbort ) {
-
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
-
- // Handle memory leak in IE
- script.onload = script.onreadystatechange = null;
-
- // Remove the script
- if ( script.parentNode ) {
- script.parentNode.removeChild( script );
- }
-
- // Dereference the script
- script = null;
-
- // Callback if not abort
- if ( !isAbort ) {
- callback( 200, "success" );
+ send: function( _, complete ) {
+ script = jQuery( "<script>" ).prop( {
+ charset: s.scriptCharset,
+ src: s.url
+ } ).on(
+ "load error",
+ callback = function( evt ) {
+ script.remove();
+ callback = null;
+ if ( evt ) {
+ complete( evt.type === "error" ? 404 : 200, evt.type );
}
}
- };
+ );
- // 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 );
+ document.head.appendChild( script[ 0 ] );
},
-
abort: function() {
- if ( script ) {
- script.onload( undefined, true );
+ if ( callback ) {
+ callback();
}
}
};
}
-});
+} );
-});
+} );