diff options
author | jaubourg <j@ubourg.net> | 2011-01-16 02:57:39 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-01-16 02:57:39 +0100 |
commit | 8ab23aec2c333834a6e442fa15b73125ba857afe (patch) | |
tree | 1dc62c9cfc6e16eccf71d54a9964f7c615c03fc3 /src/ajax/script.js | |
parent | d9cb69873c0be7cb2f65d24deeb6a01fada0661b (diff) | |
download | jquery-8ab23aec2c333834a6e442fa15b73125ba857afe.tar.gz jquery-8ab23aec2c333834a6e442fa15b73125ba857afe.zip |
Fixes #2994. Not finding a transport now fires the error callbacks and doesn't make ajax return false. Had to revise how jsonp and script prefilters & transports work (better separation of concerns). Also took the opportunity to revise jXHR getRequestHeader and abort methods and enabled early transport garbage collection when the request completes.
Diffstat (limited to 'src/ajax/script.js')
-rw-r--r-- | src/ajax/script.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/ajax/script.js b/src/ajax/script.js index 8e2e89ac5..ee1d489eb 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -15,18 +15,22 @@ jQuery.ajaxSetup({ "text script": jQuery.globalEval } -// Bind script tag hack transport -}).ajaxTransport("script", function(s) { +// Handle cache's special case and global +}).ajaxPrefilter("script", function(s) { - // Handle cache special case if ( s.cache === undefined ) { s.cache = false; } - // This transport only deals with cross domain get requests - if ( s.crossDomain && s.async && ( s.type === "GET" || ! s.data ) ) { - + if ( s.crossDomain ) { s.global = false; + } + +// Bind script tag hack transport +}).ajaxTransport("script", function(s) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { var script, head = document.getElementsByTagName("head")[0] || document.documentElement; |