When creating a new Deferred object, if I attach handlers in the following order:
- var x = $.Deferred();
- x.done(function () { console.log('done 1'); });
- x.always(function () { console.log('always 1'); });
- x.done(function () { console.log('done 2'); });
- x.always(function () { console.log('always 2'); });
- x.resolve();
I get the following output:
done 1
always 1
done 2
always 2
Is this a bug? Why don't all of the 'done' functions fire before the 'always' functions? Why are they intermingled?
Thanks!