Skip to main content

Bug Tracker

Side navigation

#2402 closed bug (invalid)

Opened February 23, 2008 06:00PM UTC

Closed March 13, 2008 12:36AM UTC

map function string lambdas broken

Reported by: ratbeard Owned by:
Priority: major Milestone: 1.2.4
Component: core Version: 1.2.3
Keywords: map lambda function Cc:
Blocked by: Blocking:

Hello, I've noticed in jQuery 1.2.3 that the string-lambda form of the second argument to the $.map function causes an error of:

callback is not a function

[Break on this error] var value = callback( elems[ i ], i );

jquery-latest line 1199

You can see this on the documentation page . The third example use of the map function does not output its display. If you save the source code locally and open it, you can see the error.

My browser:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b3) Gecko/2008020511 Firefox/3.0b3

I'm running firebug 1.1.0b10

Attachments (1)
  • string_lambda_for_grep_and_map.patch (0.9 KB) - added by markusb March 07, 2008 12:07PM UTC.

    I copied the string-lambda feature back from the previous release. I don't know why it has been removed.

Change History (4)

Changed March 07, 2008 12:10PM UTC by markusb comment:1

Anyway, this feature should be refactored to avoid repetition.

Changed March 10, 2008 04:13AM UTC by davidserduke comment:2

This feature was originally placed in the code because it was used internally by the code powering the selectors. It has since been refactored out of the internal code to allow compatibility with Adobe AIR which recently released. There are currently no plans to add it back in and the recommended method is to use an anonymous function. You can, of course, do the necessary eval() or new Function() yourself if you really need to convert a string to a function. There are currently no plans to re-add this functionality.

Changed March 12, 2008 01:55PM UTC by markusb comment:3

String lambdas can still be used with this plugin:

Changed March 13, 2008 12:36AM UTC by davidserduke comment:4

resolution: → invalid
status: newclosed

Thanks for the tip about that plugin.