Sha256: 156c63aa2a106d5decc3d7d5c660f0459c11ce40100deaa3ba858df7e80000d7

Contents?: true

Size: 1.97 KB

Versions: 401

Compression:

Stored size: 1.97 KB

Contents

define( [
	"../core",
	"../var/document",
	"../ajax"
], function( jQuery, document ) {

// Install script dataType
jQuery.ajaxSetup( {
	accepts: {
		script: "text/javascript, application/javascript, " +
			"application/ecmascript, application/x-ecmascript"
	},
	contents: {
		script: /\b(?:java|ecma)script\b/
	},
	converters: {
		"text script": function( text ) {
			jQuery.globalEval( text );
			return text;
		}
	}
} );

// Handle cache's special case and global
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 ) {

	// This transport only deals with cross domain requests
	if ( s.crossDomain ) {

		var script,
			head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;

		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" );
						}
					}
				};

				// 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( undefined, true );
				}
			}
		};
	}
} );

} );

Version data entries

401 entries across 401 versions & 2 rubygems

Version Path
govuk_publishing_components-28.9.2 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.9.1 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.9.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.8.1 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.8.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.7.1 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.6.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.5.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.4.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.3.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.2.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.1.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-28.0.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-27.20.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-27.19.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-27.18.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-27.17.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-27.16.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-27.15.0 node_modules/jquery/src/ajax/script.js
govuk_publishing_components-27.14.2 node_modules/jquery/src/ajax/script.js