Blame view

bower_components/jquery/src/ajax/script.js 1.35 KB
a1a3bc73   Luigi Serra   graphs updates
1
  define( [
74249687   Luigi Serra   Cross browser con...
2
  	"../core",
a1a3bc73   Luigi Serra   graphs updates
3
  	"../var/document",
74249687   Luigi Serra   Cross browser con...
4
  	"../ajax"
a1a3bc73   Luigi Serra   graphs updates
5
  ], function( jQuery, document ) {
74249687   Luigi Serra   Cross browser con...
6
7
  
  // Install script dataType
a1a3bc73   Luigi Serra   graphs updates
8
  jQuery.ajaxSetup( {
74249687   Luigi Serra   Cross browser con...
9
  	accepts: {
a1a3bc73   Luigi Serra   graphs updates
10
11
  		script: "text/javascript, application/javascript, " +
  			"application/ecmascript, application/x-ecmascript"
74249687   Luigi Serra   Cross browser con...
12
13
  	},
  	contents: {
a1a3bc73   Luigi Serra   graphs updates
14
  		script: /\b(?:java|ecma)script\b/
74249687   Luigi Serra   Cross browser con...
15
16
17
18
19
20
21
  	},
  	converters: {
  		"text script": function( text ) {
  			jQuery.globalEval( text );
  			return text;
  		}
  	}
a1a3bc73   Luigi Serra   graphs updates
22
  } );
74249687   Luigi Serra   Cross browser con...
23
24
25
26
27
28
29
30
31
  
  // 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";
  	}
a1a3bc73   Luigi Serra   graphs updates
32
  } );
74249687   Luigi Serra   Cross browser con...
33
34
35
  
  // Bind script tag hack transport
  jQuery.ajaxTransport( "script", function( s ) {
a1a3bc73   Luigi Serra   graphs updates
36
  
74249687   Luigi Serra   Cross browser con...
37
38
39
40
41
  	// This transport only deals with cross domain requests
  	if ( s.crossDomain ) {
  		var script, callback;
  		return {
  			send: function( _, complete ) {
a1a3bc73   Luigi Serra   graphs updates
42
  				script = jQuery( "<script>" ).prop( {
74249687   Luigi Serra   Cross browser con...
43
44
  					charset: s.scriptCharset,
  					src: s.url
a1a3bc73   Luigi Serra   graphs updates
45
  				} ).on(
74249687   Luigi Serra   Cross browser con...
46
47
48
49
50
51
52
53
54
  					"load error",
  					callback = function( evt ) {
  						script.remove();
  						callback = null;
  						if ( evt ) {
  							complete( evt.type === "error" ? 404 : 200, evt.type );
  						}
  					}
  				);
a1a3bc73   Luigi Serra   graphs updates
55
56
  
  				// Use native DOM manipulation to avoid our domManip AJAX trickery
74249687   Luigi Serra   Cross browser con...
57
58
59
60
61
62
63
64
65
  				document.head.appendChild( script[ 0 ] );
  			},
  			abort: function() {
  				if ( callback ) {
  					callback();
  				}
  			}
  		};
  	}
a1a3bc73   Luigi Serra   graphs updates
66
  } );
74249687   Luigi Serra   Cross browser con...
67
  
a1a3bc73   Luigi Serra   graphs updates
68
  } );