innerHTML vs jQuery html func (v2)

Revision 2 of this benchmark created by manast on


Preparation HTML

<div id="motherfucker">

<h1>I'm serious as a heart attack</h1>
<p>Do you see any Teletubbies in here? Do you see a slender plastic tag clipped to my shirt with my name printed on it? Do you see a little Asian child with a blank expression on his face sitting outside on a mechanical helicopter that shakes when you put quarters in it? No? Well, that's what you see at a toy store. And you must think you're in a toy store, because you're here shopping for an infant named Jeb.</p>


</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
  $a = $("#motherfucker")
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
JS
document.getElementById("motherfucker").innerHTML = "qwertyuiopasdfghjkl"
ready
jQuery
$("#motherfucker").html("qwertyuiopasdfghjkl")
ready
jQuery 2
$a.html("qwertyuiopasdfghjkl")
ready
jQuery3
$a[0].innerHTML = "qwertyuiopasdfghjkl"
ready

Revisions

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

  • Revision 1: published by Philip Harrison on
  • Revision 2: published by manast on