Skip to main content

Bug Tracker

Side navigation

#15019 closed bug (notabug)

Opened April 16, 2014 10:55AM UTC

Closed April 17, 2014 08:53PM UTC

$.when.apply expands the returning array if it has only one item

Reported by: davidshen84 Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.1.0
Keywords: Cc:
Blocked by: Blocking:

Please see sample code at The sample code is created against v2.1.0, but I found it when using v1.8.x in my own project.


In case 1, the input array has more than one item, the following done will call the callback function with all the resolved promises in an array

In case 2, the input array has only one item, the following done call the callback with the resolved promise as the only argument, but not as an array.

This causes the callback function has to implement different logic to handle different arguments schema.

Attachments (0)
Change History (1)

Changed April 17, 2014 08:53PM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

This has been discussed several times before, but the most important reason it won't change is that there is plenty of code depending on the current behavior. If you always want an array just wrap your input args in an array.