data-js selectors

JavaScript performance comparison

Test case created by Fernando

Info

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

Preparation code

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

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

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
By ID
$('#element')
pending…
By Class
$('.element')
pending…
By data-attribute
$('[data-js=element]')
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