Bug Tracker

Opened 11 years ago

Closed 9 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 dmethvin)

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 11 years ago by dmethvin

Owner: set to john

comment:2 Changed 10 years ago by dmethvin

Component: unfilledselector
Description: modified (diff)
Milestone: 1.3.21.3.3
Summary: :not returning different results then .not:not returning different results than .not
Version: 1.3.11.3.2

comment:3 Changed 9 years ago by Rick Waldron

Milestone: 1.4
Owner: changed from john to jdwbell
Priority: majorlow
Status: newpending

Please provide a reduced jsFiddle test case, thanks!

comment:4 Changed 9 years ago by jitter

Resolution: worksforme
Status: pendingclosed

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.

Last edited 9 years ago by jitter (previous) (diff)
Note: See TracTickets for help on using tickets.