Keeping in mind this statement:
Once the object has entered the resolved or rejected state, it stays in that state. Callbacks can still be added to the resolved or rejected Deferred — they will execute immediately.
What would you expect this code to produce:
var d = $.Deferred();
var a = function() {
d.done(function() {
console.log('inner');
});
console.log('outer');
};
d.done(a);
d.resolve();
?
I'm expecting it to be inner
, then outer
. Whereas it's not the case for any jquery version I checked.
Would you consider it as a bug or am I missing the point from the description?
Corresponding JSFiddle: http://jsfiddle.net/U8AGc/
UPD: some background for the question: I expect the a
method to behave similarly regardless of how exactly it was invoked: just as an a()
or d.done(a)