#7215 closed bug (invalid)
.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)
Change History (7)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
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.
comment:3 Changed 12 years ago by
Milestone: | 1.4.4 → 1.4.5 |
---|
Retargeting due to severity of regressions in 1.4.3.
comment:4 Changed 12 years ago by
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.
comment:5 Changed 12 years ago by
Version: | 1.4.3 → 1.5 |
---|
There wasn't a 1.4.5 release, was actually 1.5.
comment:6 Changed 12 years ago by
Milestone: | 1.4.5 → 1.5 |
---|
There was no 1.4.5 release, was actually 1.5.
comment:7 Changed 11 years ago by
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/