remove children (v482)

Revision 482 of this benchmark created by Jaibatrik Dutta on


Preparation HTML

<div id='wrap'>
<div id='box'></div>
</div>

Setup

function write()
  {
   var box = document.getElementById('box');
  var div = document.createElement('div');
  div.innerHTML = "halo <br> des <div>aaaa</div><table></table>";
  box.appendChild(div);
  
  }

Test runner

Ready to run.

Testing in
TestOps/sec
set empty innerHTML
write();
box.innerHTML = '';
ready
cloneNode
write();
var dupNode = box.cloneNode(false);
box.parentNode.replaceChild(dupNode, box);
ready
remove firstchild in while
write();
while (box.removeChild(box.firstChild)) {}
ready
remove firstChild
write();
while (box.firstChild) {
  box.removeChild(box.firstChild);
}
ready
Test 1, avoiding repaint
write();
box.style.display='none';
box.innerHTML = '';
box.style.display='';
ready
set empty innerText
write();
box.innerText = '';
ready

Revisions

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