It has come to me the following query. Consider the next line of code:
case A:
$('#box').promise().done(function(){alert('Okay');});
In the above case, the alert message will be shown up immediately since $('#box').promise()
will return a resolved promise object and the done callback will fire immediately. Now, if we change the above code to:
case B:
$('#box').hide(5000);
$('#box').promise().done(function(){alert('Okay');});
the done callback will fire after 5 seconds. In that case I cannot find out in which way jQuery recognizes that $('#box') in the second line in case B is different from $('#box') in case A and knows that .hide() method is already applied on it as to correctly waiting for firing the callback. There must be some inner jQuery procedure...
Hope to be comprehensible.