scratch – Diff between revs 58 and 125

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 58 Rev 125
Line 1... Line 1...
1 define( [ 1 define([
2 "../core", 2 "../core",
3 "../var/document", -  
4 "../ajax" 3 "../ajax"
5 ], function( jQuery, document ) { 4 ], function( jQuery ) {
6   -  
7 "use strict"; -  
8   -  
9 // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -  
10 jQuery.ajaxPrefilter( function( s ) { -  
11 if ( s.crossDomain ) { -  
12 s.contents.script = false; -  
13 } -  
14 } ); -  
Line 15... Line 5...
15   5  
16 // Install script dataType 6 // Install script dataType
17 jQuery.ajaxSetup( { 7 jQuery.ajaxSetup({
18 accepts: { 8 accepts: {
19 script: "text/javascript, application/javascript, " + -  
20 "application/ecmascript, application/x-ecmascript" 9 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
21 }, 10 },
22 contents: { 11 contents: {
23 script: /\b(?:java|ecma)script\b/ 12 script: /(?:java|ecma)script/
24 }, 13 },
25 converters: { 14 converters: {
26 "text script": function( text ) { 15 "text script": function( text ) {
27 jQuery.globalEval( text ); 16 jQuery.globalEval( text );
28 return text; 17 return text;
29 } 18 }
30 } 19 }
Line 31... Line 20...
31 } ); 20 });
32   21  
33 // Handle cache's special case and crossDomain 22 // Handle cache's special case and crossDomain
34 jQuery.ajaxPrefilter( "script", function( s ) { 23 jQuery.ajaxPrefilter( "script", function( s ) {
35 if ( s.cache === undefined ) { 24 if ( s.cache === undefined ) {
36 s.cache = false; 25 s.cache = false;
37 } 26 }
38 if ( s.crossDomain ) { 27 if ( s.crossDomain ) {
39 s.type = "GET"; 28 s.type = "GET";
Line 40... Line 29...
40 } 29 }
41 } ); 30 });
42   -  
43 // Bind script tag hack transport 31  
44 jQuery.ajaxTransport( "script", function( s ) { 32 // Bind script tag hack transport
45   33 jQuery.ajaxTransport( "script", function( s ) {
46 // This transport only deals with cross domain requests 34 // This transport only deals with cross domain requests
47 if ( s.crossDomain ) { 35 if ( s.crossDomain ) {
48 var script, callback; 36 var script, callback;
-   37 return {
49 return { 38 send: function( _, complete ) {
50 send: function( _, complete ) { 39 script = jQuery("<script>").prop({
51 script = jQuery( "<script>" ).prop( { 40 async: true,
52 charset: s.scriptCharset, 41 charset: s.scriptCharset,
53 src: s.url 42 src: s.url
54 } ).on( 43 }).on(
55 "load error", 44 "load error",
56 callback = function( evt ) { 45 callback = function( evt ) {
57 script.remove(); 46 script.remove();
58 callback = null; 47 callback = null;
59 if ( evt ) { 48 if ( evt ) {
60 complete( evt.type === "error" ? 404 : 200, evt.type ); 49 complete( evt.type === "error" ? 404 : 200, evt.type );
61 } -  
62 } -  
63 ); 50 }
64   51 }
65 // Use native DOM manipulation to avoid our domManip AJAX trickery 52 );
66 document.head.appendChild( script[ 0 ] ); 53 document.head.appendChild( script[ 0 ] );
67 }, 54 },
68 abort: function() { 55 abort: function() {
69 if ( callback ) { 56 if ( callback ) {
70 callback(); 57 callback();
71 } 58 }
72 } 59 }
Line 73... Line 60...
73 }; 60 };