innerHTML vs innerText vs nodeValue (v50)

Revision 50 of this benchmark created by Andrew on


Preparation HTML

<div id="divinputme">test</div>
<span id="spaninputme">test</span>
<script>
  var a = document.getElementById('divinputme'),
      b = document.getElementById('spaninputme');
  s = '1,2,3,4';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
innerText - div
a.innerText = s;
ready
innerText - span
b.innerText = s;
ready
innerHTML - div
a.innerHTML = s;
ready
innerHTML - span
b.innerHTML = s;
ready
nodeValue - div
a.childNodes[0].nodeValue = s;
ready
nodeValue - span
b.childNodes[0].nodeValue = s;
ready

Revisions

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