Native Dojo Class Manipulation v HTML5

JavaScript performance comparison

Revision 2 of this test case created by

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"></script>

<div id="empty_class">
</div>
<div class="a_class" id="single_class">
</div>
<div class="a_class b_class c_class" id="many_classes">
</div>
<div class="a_class b_class c_class d_class e_class f_class" id="many_classes">
</div>
    

Preparation code output

<div id="empty_class"> </div> <div class="a_class" id="single_class"> </div> <div class="a_class b_class c_class" id="many_classes"> </div> <div class="a_class b_class c_class d_class e_class f_class" id="many_classes"> </div>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Add Class - Dojo
dojo.addClass("empty_class", "some_class");
pending…
Add Class - HTML5
dojo.byId("empty_class").classList.add("some_class");
pending…
Remove Class - Dojo
dojo.removeClass("single_class", "a_class");
pending…
Remove Class - HTML5
dojo.byId("single_class").classList.remove("a_class");
pending…
Toggle Class - Dojo
dojo.toggleClass("many_classes", "a_class");
pending…
Toggle Class - HTML5
dojo.byId("many_classes").classList.toggle("a_class");
pending…
Has Class - Dojo
dojo.hasClass("single_class", "a_class");
pending…
Has Class - HTML5
dojo.byId("single_class").classList.contains("a_class");
pending…
Has Class - Dojo (End)
dojo.hasClass("many_classes", "f_class");
pending…
Has Class - HTML5 (End)
dojo.byId("many_classes").classList.contains("f_class");
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.

0 Comments