Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Commit

Permalink
next の中で Deferred を return すると処理が止まる
Browse files Browse the repository at this point in the history
  • Loading branch information
cho45 committed Mar 13, 2012
1 parent 3fa0f37 commit 58a30fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions binding/jquery.js
Expand Up @@ -36,6 +36,12 @@
ret.error = function (fun) {
return Deferred.absorb(this).error(fun);
};
ret.done(function (v) {
if (ret._next) ret._next._fire('ok', v);
});
ret.fail(function (v) {
if (ret._next) ret._next._fire('ok', v);
});
return ret;
};

Expand Down
15 changes: 15 additions & 0 deletions test-jsdeferred.js
Expand Up @@ -955,6 +955,21 @@ next(function () {
ng("$.ajax#success");
});
}).
next(function () {
return next(function() {
var d = $.Deferred();
setTimeout(function () {
d.resolve('ok');
}, 10);
return d;
}).
next(function (e) {
ok("$.Deferred " + e);
}).
error(function (e) {
ng("$.Deferred");
});
}).
error(function (e) {
ng("Error on jQuery Test:", "", e);
});
Expand Down

0 comments on commit 58a30fe

Please sign in to comment.