Skip to content Skip to sidebar Skip to footer

Does Jquery.deferred Have A Bug When A Jquery.deferred Object Is Passed To Deferred.resolve?

Given the code using Promise constructor 1 is logged at console Given the equivalent code using jQuery.Deferred the jQuery.deferred object is logged at .then(), not the value pass

Solution 1:

It's not a bug, but it might be a missing feature. jQuery never attempted to implement the standard Promise constructor, and its Deferred constructor does something quite different. Admittedly, if resolve actually fulfills, they definitely mess with the standard terminology; again however jQuery's implementation does predate the standard so it's not surprising.

Is the output a jQuery bug relevant to jQuery's implementation of the Promise/A+ specification?

No, the Promise/A+ specification is only concerned with the behaviour of the then function, not the promise construction. There were indeed many inherent problems with that in jQuery's promise implementation, but since version 3 those have been fixed at least (which can be tested), so jQuery promise instances are now interoperable with all other implementations.

Post a Comment for "Does Jquery.deferred Have A Bug When A Jquery.deferred Object Is Passed To Deferred.resolve?"