$.map is used a lot internally for everything. By the selectors module, the manipulation/traversing methods, etc. This was the desired functionality in order to simplify its internal duties.
-- Ariel Flesler http://flesler.blogspot.com On 11 jun, 07:19, Marc Galera <[EMAIL PROTECTED]> wrote: > Hi. > > I've recently been surprised with $.map. I've found that it flattens > the result so I can't return an array in the callback. For example, on > this code: > > $.map([1, 2, 3], function(n) { > return [n, 'xxx']; > > }); > > I get: > > [1, "xxx", 2, "xxx", 3, "xxx"] > > Instead of what I expected: > > [[1, "xxx"], [2, "xxx"], [3, "xxx"]] > > Looking on the source code is obvious that this is made on purpose, > and there are workarounds, but I was curious on why this is happening. > > Marc.