Removing an element from the screen

JavaScript performance comparison

Revision 3 of this test case created by

Preparation code

<script>
var testDIV = document.createElement('div');
testDIV.innerHTML = "Hello World";
</script>
      
<script>
Benchmark.prototype.setup = function() {
  document.body.appendChild(testDIV);
  testDIV.style.left = "10px";
  testDIV.style.top= "10px";

};

Benchmark.prototype.teardown = function() {
  document.body.appendChild(testDIV);
  testDIV.style.left = "10px";
  testDIV.style.top= "10px";

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Display = "none"
testDIV.style.display="block";

testDIV.style.display="none";

pending…
removeChild
document.body.appendChild(testDIV);

document.body.removeChild(testDIV);
pending…
Move off screen
testDIV.style.left="10px";

testDIV.style.left="-9999px";

pending…

Compare results of other browsers

Revisions

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

0 Comments