Bug Tracker

Opened 12 years ago

Closed 12 years ago

#2402 closed bug (invalid)

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:

Description

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 (888 bytes) - added by markusb 12 years ago.
I copied the string-lambda feature back from the previous release. I don't know why it has been removed.

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by markusb

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

comment:1 Changed 12 years ago by markusb

Anyway, this feature should be refactored to avoid repetition.

comment:2 Changed 12 years ago by davidserduke

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.

comment:3 Changed 12 years ago by markusb

String lambdas can still be used with this plugin:

http://plugins.jquery.com/project/string-lambdas

comment:4 Changed 12 years ago by davidserduke

Milestone: 1.2.31.2.4
Resolution: invalid
Status: newclosed

Thanks for the tip about that plugin.

Note: See TracTickets for help on using tickets.