Empty an element (v9)

Revision 9 of this benchmark created on


Preparation HTML

<div id="myroot">
  <div>
<img src="https://www.google.com/logos/2012/ada_lovelaces_197th_birthday-991005-hp.jpg"/>
  </div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
Empty one by one
var el = document.getElementById("myroot");
while (el.firstChild) {
  el.removeChild(el.firstChild);
}
 
ready
Empty innerHTML
var el = document.getElementById("myroot");
el.innerHTML = "";
 
ready

Revisions

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