git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reworked script and xhr abort logic to take advantage of the fact jXHR.abort will...
[jquery.git]
/
src
/
ajax
/
script.js
diff --git
a/src/ajax/script.js
b/src/ajax/script.js
index
0db0de6
..
645ddf3
100644
(file)
--- a/
src/ajax/script.js
+++ b/
src/ajax/script.js
@@
-1,7
+1,7
@@
(function( jQuery ) {
(function( jQuery ) {
-// Install text to script executor
-jQuery.extend( true, jQuery.ajaxSettings , {
+// Install script dataType
+jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript"
accepts: {
script: "text/javascript, application/javascript"
@@
-14,7
+14,7
@@
jQuery.extend( true, jQuery.ajaxSettings , {
converters: {
"text script": jQuery.globalEval
}
converters: {
"text script": jQuery.globalEval
}
-} );
+});
// Bind script tag hack transport
jQuery.ajax.transport("script", function(s) {
// Bind script tag hack transport
jQuery.ajax.transport("script", function(s) {
@@
-47,7
+47,7
@@
jQuery.ajax.transport("script", function(s) {
script.src = s.url;
// Attach handlers for all browsers
script.src = s.url;
// Attach handlers for all browsers
- script.onload = script.onreadystatechange = function( _ , statusText) {
+ script.onload = script.onreadystatechange = function( _ , isAbort ) {
if ( ! script.readyState || /loaded|complete/.test( script.readyState ) ) {
if ( ! script.readyState || /loaded|complete/.test( script.readyState ) ) {
@@
-59,10
+59,13
@@
jQuery.ajax.transport("script", function(s) {
head.removeChild( script );
}
head.removeChild( script );
}
+ // Dereference the script
script = 0;
script = 0;
- // Callback
- callback( statusText ? 0 : 200, statusText || "success" );
+ // Callback if not abort
+ if ( ! isAbort ) {
+ callback( 200, "success" );
+ }
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
@@
-70,9
+73,9
@@
jQuery.ajax.transport("script", function(s) {
head.insertBefore( script, head.firstChild );
},
head.insertBefore( script, head.firstChild );
},
- abort: function(statusText) {
+ abort: function() {
if ( script ) {
if ( script ) {
- script.onload( 0 , statusText );
+ script.onload(0,1);
}
}
};
}
}
};