diff --git a/pages/upgrade-guide/3.0.md b/pages/upgrade-guide/3.0.md index 2801714..042d96c 100644 --- a/pages/upgrade-guide/3.0.md +++ b/pages/upgrade-guide/3.0.md @@ -347,14 +347,24 @@ https://github.com/jquery/jquery/issues/1722 https://github.com/jquery/jquery/issues/2102 https://github.com/jquery/jquery/issues/2736 -#### Breaking change and Feature: $.when() inputs and progress notifications +#### Breaking change and Feature: $.when() arguments -The $.when() method now interprets that any input argument with a `.then()` method is a Promise or Deferred compatible object. In previous versions, if a single Deferred was passed as an input argument, `$.when()` would re-use it and return it as the output Deferred. Now, it *always* returns a new Deferred. This allows any type of`then`-able to be passed as input, including native ES6 Promise or Bluebird promises. You can also convert to the output Deferred to an ES6 promise with `Promise.resolve()` where native Promise is supported. +`$.when` now interprets any input argument with a `then` method as a Promise-compatible "[thenable](https://promisesaplus.com/#point-7)". This allows a much broader range of inputs, including native ES6 Promises and Bluebird promises. + +Further, a more clear distinction is now recognized between multi-argument calls to `$.when` and single- or no-argument calls. +Multi-argument calls behave similarly to `Promise.all`, aggregating fulfillment values into a fulfillment array (with jQuery-specific enhancements of also aggregating fulfillment contexts and supporting multi-valued fulfillments), or alternatively rejecting with the first rejection value. +Single- and no-argument calls behave similarly to `Promise.resolve`, returning a Deferred that resolves identically to thenable or Promise-like input, or fulfills with its non-Promise input (as appropriate). +As of jQuery 3.0, both of these return a new Deferred (previous versions did not create a new Deferred when called with a single Deferred input). + +https://github.com/jquery/jquery/issues/2018 +https://github.com/jquery/jquery/issues/2546 +https://github.com/jquery/jquery/issues/3029 + +#### Breaking change: $.when() progress notifications As of jQuery 3.0, the `$.when()` method no longer passes along progress notifications from input Deferreds to the output Deferred. Progress messages are not part of the Promises/A+ specification, and the behavior of progress notifications in `$.when()` were not previously documented in the jQuery API. https://github.com/jquery/jquery/issues/2710 -https://github.com/jquery/jquery/issues/2546 ### Dimensions