Opened 14 years ago
Closed 12 years ago
#3976 closed bug (worksforme)
:not returning different results than .not
Reported by: | jdwbell | Owned by: | jdwbell |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | selector | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
In the example given below these two return the expected elements (exclude only divs which contain other divs):
$('*').not('div:has(div)')
$('*').not($('div:has(div)'))
but these three do not (they seem to be excluding all divs as well as all other elements which contain divs:
$(':not(div:has(div))')
$('*:not(div:has(div))')
$('*').filter(':not(div:has(div))')
Tested on Chrome, Firefox, IE6, and Safari.
Thanks!
<html> <head> <style> div, fieldset, p { border: ridge 1px silver; padding: 20px; margin: 20px; } .wrappedElement { border: ridge 2px #FF0000; } </style> <script type="text/javascript" src="jquery-1.3.1.js"></script> <script> $(function(){ //$(':not(div:has(div))').addClass('wrappedElement'); //$('*:not(div:has(div))').addClass('wrappedElement'); //$('*').filter(':not(div:has(div))').addClass('wrappedElement'); //$('*').not('div:has(div)').addClass('wrappedElement'); $('*').not($('div:has(div)')).addClass('wrappedElement'); }); </script> </head> <body> <div> <div> <div> <p>paragraph surrounded by three divs</p> </div> </div> </div> <fieldset> <div> div surrounded by fieldset </div> </fieldset> </body> </html>
Change History (4)
comment:1 Changed 14 years ago by
Owner: | set to john |
---|
comment:2 Changed 13 years ago by
Component: | unfilled → selector |
---|---|
Description: | modified (diff) |
Milestone: | 1.3.2 → 1.3.3 |
Summary: | :not returning different results then .not → :not returning different results than .not |
Version: | 1.3.1 → 1.3.2 |
comment:3 Changed 12 years ago by
Milestone: | 1.4 |
---|---|
Owner: | changed from john to jdwbell |
Priority: | major → low |
Status: | new → pending |
comment:4 Changed 12 years ago by
Resolution: | → worksforme |
---|---|
Status: | pending → closed |
test case. Can't reproduce this. All for variants yield the same correct result. If you feel this ticket was incorrectly closed, feel free to report back and reopen with a reproducible test case.
Please provide a reduced jsFiddle test case, thanks!