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