jQuery CSS3 Not vs. .Not() - Class

JavaScript performance comparison

Revision 31 of this test case created by edc

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. Original test by Jeffrey Way. Modified to check class instead of id.

Preparation code

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

Preparation code output

my class
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(.myclass)');
pending…
Not() Method
var d = $('div').not('.myclass');
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