$.when() surprisingly differs from $.Deferred.promise()
What we have
The jQuery documentation describes $.when() as a sort of the promise generator:
If a single Deferred is passed to jQuery.when(), its Promise object (a subset of the Deferred methods) is returned by the method.
The Deferred.promise() chains all three its event pairs:
- resolve() - done()
- reject() - fail()
- notify() - progress()
At the same time, the $.when() returns a promise which chains the only two event pairs:
- resolve() - done()
- reject() - fail()
Look to the following screenshots:
Deferred.promise sample:
$.when sampe
What I would like to see
When the only parameter is used, the $.when() call should return a promise like the $.Deferred.promise() does with all three pairs chained.
In order to provide some acceptable behavior, the $.when() call with multiple parameters should return such a promise that passes any source notify() call to the target progress() callback.
Technical details:
Browser Chromium 66.0.3359.181 (Official) Built on Ubuntu, running on Ubuntu 17.10 (64 бит)
jQuery v.3.3.1
Regards,
Vsevolod