Modify ↓
Ticket #1270 (closed bug: worksforme)
$.map removes duplicates
| Reported by: | dhull | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.1.4 |
| Component: | core | Version: | 1.1.3 |
| Keywords: | map | Cc: | |
| Blocking: | Blocked by: |
Description
The documentation for $.map has the following example:
$.map( [0,1,2], function(n){
return [ n, n + 1 ];
});
It says that the result should be:
[0, 1, 1, 2, 2, 3]
However in version 1.1.2, the jQuery.map function has code to remove duplicates. The actual result from jQuery 1.1.2 is:
[0, 1, 2, 3]
Actually, looking at the trunk, it appears that this bug was already fixed with the code change in revision 1576, but I'm going to report it anyway, in case a regression test should be created.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This is no longer the case. $.map() only merges the results.