Skip to main content

Bug Tracker

Side navigation

#5686 closed enhancement (wontfix)

Opened December 19, 2009 08:40PM UTC

Closed November 01, 2010 05:30AM UTC

$.map is not consistent with $#each, $#map and $.each

Reported by: robertsosinski Owned by:
Priority: minor Milestone: 1.4
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:
Description

I notice that with $.map, both the function parameter order and "this" reassignment is inconsistent with other enumerable methods, such as $#each, $#map and $.each. Attached is a script showing how this can make for easy mistakes.

I think it would make more sense to have the function passed to $.map take (index, element) instead of (element, index), and also reassign "this" to the current element worked with. Unless, there are specific technical reasons for the API to work in its current fashion.

Thanks,

Robert

Attachments (1)
  • map_example.html (1.6 KB) - added by robertsosinski December 19, 2009 08:41PM UTC.
Change History (2)

Changed December 20, 2009 02:49AM UTC by dmethvin comment:1

type: bugenhancement

It may not be consistent, but there is probably a lot of code that would break if this was changed.

Changed November 01, 2010 05:30AM UTC by snover comment:2

resolution: → wontfix
status: newclosed

There is no way to fix this and maintain backward-compatibility.