git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d60b197
)
Simplified some of the logic for handling the ajax aborts, making sure that ajaxStop...
author
jeresig
<jeresig@gmail.com>
Tue, 12 Jan 2010 15:59:50 +0000
(10:59 -0500)
committer
jeresig
<jeresig@gmail.com>
Tue, 12 Jan 2010 15:59:50 +0000
(10:59 -0500)
src/ajax.js
patch
|
blob
|
history
diff --git
a/src/ajax.js
b/src/ajax.js
index
e9b02fc
..
83e5bdc
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-390,18
+390,19
@@
jQuery.extend({
// Wait for a response to come back
var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
// Wait for a response to come back
var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
- // The request was aborted, clear the interval and decrement jQuery.active
+ // The request was aborted
if ( !xhr || xhr.readyState === 0 ) {
if ( !xhr || xhr.readyState === 0 ) {
+ // Opera doesn't call onreadystatechange before this point
+ // so we simulate the call
+ if ( !requestDone ) {
+ complete();
+ }
+
requestDone = true;
if ( xhr ) {
xhr.onreadystatechange = jQuery.noop;
}
requestDone = true;
if ( xhr ) {
xhr.onreadystatechange = jQuery.noop;
}
- // Handle the global AJAX counter
- if ( s.global && ! --jQuery.active ) {
- jQuery.event.trigger( "ajaxStop" );
- }
-
// The transfer is complete and the data is available, or the request timed out
} else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
requestDone = true;
// The transfer is complete and the data is available, or the request timed out
} else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
requestDone = true;
@@
-456,15
+457,11
@@
jQuery.extend({
xhr.abort = function() {
oldAbort.call( xhr );
xhr.abort = function() {
oldAbort.call( xhr );
- if ( !requestDone ) {
- complete();
- }
-
if ( xhr ) {
if ( xhr ) {
- xhr.onreadystatechange = null;
+ xhr.readyState = 0;
}
}
- requestDone = true;
+ onreadystatechange();
};
} catch(e) { }
};
} catch(e) { }