Class or Name Attr Lookup

JavaScript performance comparison

Revision 5 of this test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<div id="wrapper">
  <div class="title" name="title">My Title is Good!</div>
  <div>Nothing to see here</div>
  <div class="content">
    <p>Lorem ipsum dolor sit amet...</p>
    <p>All your base are belong to us!</p>
  </div>
  <div class="footer">Signing off.</div>
</div>

Preparation code output

My Title is Good!
Nothing to see here

Lorem ipsum dolor sit amet...

All your base are belong to us!

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Name w/o scope
$("[name=title]")
pending…
Class w/o scope
$(".title")
pending…
Named w/ scope
$("#wrapper").find("[name=title]")
pending…
Class w/ scope
$("#wrapper").find(".title")
pending…
Children
$("#wrapper").children(".title")
pending…
Id scope with class
$("#wrapper .title")
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