id vs class vs attr selectors (v196)

Revision 196 of this benchmark created by Keith Chu on


Preparation HTML

<div class="baz">
<p id="js-foo" class="js-foo" data-js="tabs"></p>
</div>

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

Test runner

Ready to run.

Testing in
TestOps/sec
[data-js=tabs]
var element = $('[data-js=tabs]')
ready
[data-js]
var element = $('[data-js]')
ready
$('.baz').find('[data-js=tabs]')
var element = $('.baz').find('[data-js=tabs]')
ready

Revisions

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