Side navigation
#7215 closed bug (invalid)
Opened October 16, 2010 06:27PM UTC
Closed December 30, 2010 04:05AM UTC
Last modified January 28, 2012 04:42AM UTC
.not() on contents() has problems with selector
Reported by: | leo | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.5 |
Component: | traversing | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
there's seems to be a problem using not() with selectors:
I have a div ($foo) with textnodes and buttons.
$foo.contents().not($j('button')) works (returns all textnodes)
$foo.contents().not('button') does not work (returns empty)
Attachments (0)
Change History (7)
Changed October 16, 2010 06:36PM UTC by comment:1
Changed October 16, 2010 09:50PM UTC by comment:2
component: | unfiled → traversing |
---|---|
priority: | undecided → low |
status: | new → open |
This is because the winnow
function filters out nodes that are not of type NODE_ELEMENT
when the qualifier passed is a string.
Changed October 21, 2010 10:57PM UTC by comment:3
milestone: | 1.4.4 → 1.4.5 |
---|
Retargeting due to severity of regressions in 1.4.3.
Changed December 30, 2010 04:05AM UTC by comment:4
resolution: | → invalid |
---|---|
status: | open → closed |
After retrieving text nodes, any function that filters using a selector string will remove text nodes. To avoid that, you can use .filter(function)
and remove anything that isn't a text node, rather than using the button
selector.
Changed January 31, 2011 05:53PM UTC by comment:5
version: | 1.4.3 → 1.5 |
---|
There wasn't a 1.4.5 release, was actually 1.5.
Changed January 31, 2011 05:54PM UTC by comment:6
milestone: | 1.4.5 → 1.5 |
---|
There was no 1.4.5 release, was actually 1.5.
Changed January 28, 2012 04:42AM UTC by comment:7
I believe there's still an issue here.
if($('div').not('.foo,.bar')) returns what looks to be empty objects for the filtered selectors instead of completely removing them
on the other hand
if(!$('div').is('.foo,.bar')) works just fine, shouldn't it be the same?
Please see this fiddle:
http://jsfiddle.net/DJkVx/6/