jQuery standards over qualified selectors (v3)

Revision 3 of this benchmark created on


Description

Why you shouldn't over-qualify your jQuery selectors

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div>
  <div class='class'>
    <div id='id'>
    </div>
    <div class='class2'>
    </div>
    <div id='id2'>
    </div>
  </div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
Single, Simple Selectors
var $class = jQuery('.class');
ready
Over Qualified
var $class = jQuery('div div.class');
ready
Qualified
var $class = jQuery('div.class');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Stephen Mathieson on
  • Revision 2: published by Steve on
  • Revision 3: published on