Side navigation
#2851 closed enhancement (fixed)
Opened May 13, 2008 01:04PM UTC
Closed July 26, 2010 12:24AM UTC
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
Attachments (0)
Change History (8)
Changed May 13, 2008 04:02PM UTC by comment:1
| owner: | → flesler | 
|---|---|
| status: | new → assigned | 
Changed August 24, 2008 11:52PM UTC by comment:4
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.
Changed August 24, 2008 11:56PM UTC by comment:5
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 ) 
      })
            Changed August 24, 2008 11:57PM UTC by comment:6
OK, I can't get WikiFormatting to listen to me. Ignore the first ! in the code above.
Changed December 25, 2008 08:31PM UTC by comment:7
| cc: | → scott.gonzalez, john | 
|---|---|
| component: | core → selector | 
| milestone: | 1.2.4 → 1.3 | 
Changed July 26, 2010 12:24AM UTC by comment:8
| resolution: | → fixed | 
|---|---|
| status: | assigned → closed | 
Fixed in 1.3: http://docs.jquery.com/Release:jQuery_1.3#Features