Bug Tracker

Opened 15 years ago

Closed 13 years ago

#2851 closed enhancement (fixed)

filter and is should accept complex selectors

Reported by: scottgonzalez Owned by: flesler
Priority: major Milestone: 1.3
Component: selector Version: 1.2.3
Keywords: Cc: scott.gonzalez, john
Blocked by: Blocking:

Description


Change History (8)

comment:1 Changed 15 years ago by flesler

Owner: set to flesler
Status: newassigned

comment:2 Changed 15 years ago by joern

Related to #3137

comment:3 Changed 15 years ago by joern

Related/duplicate to/of #2266.

comment:4 Changed 15 years ago by d.wachss

Rather than adding complex selectors (which would require more sophisticated string parsing and likely slow down everything), why not be consistent with "not" and allow arrays? Something like:

selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType &&

return this.filter(function(){

jQuery.inArray( this, selector )

})

Then you could do $('code').filter($('pre > code')) which might be slow itself but would not affect other uses of filter.

comment:5 Changed 15 years ago by d.wachss

Oops--WikiFormatting killed my code. Supposed to be:

  !|| selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType &&  
      return this.filter(function(){ 
        jQuery.inArray( this, selector ) 
      })

comment:6 Changed 15 years ago by d.wachss

OK, I can't get WikiFormatting to listen to me. Ignore the first ! in the code above.

comment:7 Changed 14 years ago by flesler

Cc: scott.gonzalez john added
Component: coreselector
Milestone: 1.2.41.3

comment:8 Changed 13 years ago by dmethvin

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.