Skip to main content

Bug Tracker

Side navigation

#7008 closed bug (worksforme)

Opened September 07, 2010 09:19AM UTC

Closed September 08, 2010 12:19AM UTC calls with elements reversed

Reported by: joost_m Owned by:
Priority: Milestone: 1.4.3
Component: core Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

This correctly returns an array with the elements 'a', 'b' and 'c':

$(['a','b','c']).map(function(elem,index) { return this; });

This incorrectly returns the indices:

$(['a','b','c']).map(function(elem,index) { return elem; });

And this incorrectly returns the elements:

$(['a','b','c']).map(function(elem,index) { return index; });

So the arguments to the callback are reversed, if the documentation of $.map is to be believed.

Attachments (0)
Change History (1)

Changed September 08, 2010 12:19AM UTC by dmethvin comment:1

component: unfiledcore
resolution: → worksforme
status: newclosed

You're confusing with jQuery().map()

The args are reversed but it would break a lot of code to change it.