jQuery CSS3 Not vs. .Not()

JavaScript performance comparison

Revision 10 of this test case created

Info

The jQuery docs specify that it's better to use .not() over $('x:not(y)'). Testing to make sure that's the case in all browsers.

Preparation code

<div id="container">
      <div class="header"> Header </div>
      <div class="noid">Div</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Preparation code output

Header
Div

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
CSS3 Selector
var d = $('div:not(.header)');
pending…
Not() Method
var d = $('div').not('.header');
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment