class vs tag+class selector (v2)

Revision 2 of this benchmark created by Mauricio Wolff on


Preparation HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="boom">
<p>Hey...</p>
</div>
<script>
  var undo = function() {
   document.getElementById("bam").id = "boom";
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
with tag
$("#boom").attr("id", "bam");
undo();
ready
without tag
document.getElementById("boom").id = "bam";
undo();
ready
Without attr
$("#boom")[0].id = "bam";
undo();
ready

Revisions

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

  • Revision 2: published by Mauricio Wolff on