Permalink
Browse files

Fix for #46 - jQuery 1.3.2 no longer calls success on timeout

  • Loading branch information...
mlynch committed Mar 21, 2012
1 parent cdb2c40 commit fd882d2611b39171909a988fa60f273776575a1e
Showing with 5 additions and 1 deletion.
  1. +4 −0 jquery.mockjax.js
  2. +1 −1 test/test.js
View
@@ -300,6 +300,10 @@
if ( $.isFunction(this.onreadystatechange) && !m.isTimeout ) {
this.onreadystatechange( m.isTimeout ? 'timeout' : undefined );
} else if ( m.isTimeout ) {
+ if ( $.isFunction( $.handleError ) ) {
+ // Fix for 1.3.2 timeout to keep success from firing.
+ this.readyState = -1;
+ }
s.error( this, "timeout" );
s.complete( this, "timeout" );
}
View
@@ -640,7 +640,7 @@ asyncTest('Forcing timeout', function() {
$.ajax({
url: '/response-callback',
- error: function() {
+ error: function(xhr) {
ok(true, "error callback was called");
},
success: function(response) {

0 comments on commit fd882d2

Please sign in to comment.