Bug Tracker

Modify

Ticket #1471 (closed bug: wontfix)

Opened 6 years ago

Last modified 6 years ago

filter() should accept the same arguments as not()

Reported by: joern Owned by:
Priority: minor Milestone: 1.1.4
Component: core Version: 1.1.3
Keywords: Cc:
Blocking: Blocked by:

Description

Assuming that the variable selector in the following example can be a selector string and a DOM element or jQuery object:

headers.not(headers.not(selector))

This should be the same as:

headers.filter(selector)

but filter accepts only callbacks and strings.

Change History

comment:1 Changed 6 years ago by john

  • Status changed from new to closed
  • Resolution set to wontfix
Why? What would be the purpose of passing in either one of those? In both cases it would just reduce the jQuery object to nothing but what you passed in - effectively making it the same as $(element
object).

comment:2 Changed 6 years ago by joern

An example:

headers = $("div.header");

// some client code passing in the selector
selector = ":eq(0)"
// works, because filter accepts strings
headers.filter(selector) 

// same client code, but passes in an dom element
selector = document;
// doesn't work
headers.filter(document)
// works
headers.not(headers.not(selector))

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.