data-js selectors

Benchmark created by Fernando on


Description

This test is related to this blog post: http://toddmotto.com/data-js-selectors-enhancing-html5-development-by-separating-css-from-javascript/

Preparation HTML

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

<div id="#element" class="element" data-js="element"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
By ID
$('#element')
ready
By Class
$('.element')
ready
By data-attribute
$('[data-js=element]')
ready

Revisions

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