3 // Install text to script executor
4 jQuery.extend( true, jQuery.ajaxSettings , {
7 script: "text/javascript, application/javascript"
15 "text => script": jQuery.globalEval
19 // Bind script tag hack transport
20 jQuery.xhr.bindTransport("script", function(s) {
22 // Handle cache special case
23 if ( s.cache === undefined ) {
27 // This transport only deals with cross domain get requests
28 if ( s.crossDomain && s.async && ( s.type === "GET" || ! s.data ) ) {
33 head = document.getElementsByTagName("head")[0] || document.documentElement;
37 send: function(_, callback) {
39 script = document.createElement("script");
41 script.async = "async";
43 if ( s.scriptCharset ) {
44 script.charset = s.scriptCharset;
49 // Attach handlers for all browsers
50 script.onload = script.onreadystatechange = function( _ , statusText) {
52 if ( ! script.readyState || /loaded|complete/.test( script.readyState ) ) {
54 // Handle memory leak in IE
55 script.onload = script.onreadystatechange = null;
58 if ( head && script.parentNode ) {
59 head.removeChild( script );
65 callback( statusText ? 0 : 200, statusText || "success" );
68 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
69 // This arises when a base node is used (#2709 and #4378).
70 head.insertBefore( script, head.firstChild );
73 abort: function(statusText) {
75 script.onload( 0 , statusText );