Opened 9 years ago
Closed 9 years ago
#14409 closed bug (notabug)
.map(fn).toArray() and .map(fn).get() will flatten inner arrays
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Mapping over a selection with a function that returns arrays will flatten all returned values into a 1d array, instead of returning a 2d array as expected.
To reproduce:
$('<p/>').map(function() { return [1,2]; }).get(); // [1,2] $('<p/><p/>').map(function() { return [1,2]; }).get(); // [1,2,1,2]
Note: See
TracTickets for help on using
tickets.
Was that expected after reading the docs?