Bug Tracker

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1471 closed bug (wontfix)

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:
Blocked by: Blocking:

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 (2)

comment:1 Changed 15 years ago by john

Resolution: wontfix
Status: newclosed
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 15 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))
Note: See TracTickets for help on using tickets.