Skip to main content

Bug Tracker

Side navigation

#10954 closed enhancement (wontfix)

Opened December 05, 2011 09:13PM UTC

Closed December 06, 2011 12:02AM UTC

The function parameter to jQuery.grep should be optional

Reported by: michaelmior Owned by:
Priority: low Milestone: None
Component: core Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

It would be great if the team could consider making the function parameter to grep optional.

I would suggest that

$.grep(['a', 'b', false]);

be the equivalent of

$.grep(['a', 'b', false], function(x) { return x; });

to allow the removal of falsy values. Note that this wouldn't be a breaking change.

Attachments (0)
Change History (2)

Changed December 05, 2011 09:16PM UTC by michaelmior comment:1

Here is a simple jsFiddle demonstrating the suggested behaviour:

Changed December 06, 2011 12:02AM UTC by timmywil comment:2

component: unfiledcore
priority: undecidedlow
resolution: → wontfix
status: newclosed

Since grep is mainly used internally, I don't think this will make it into core.