createElement vs cloneNode (v2)

Revision 2 of this benchmark created by Kiran Makam on


Description

Creating a node with couple of style attributes

Preparation HTML

<script>
  var masterDiv = document.createElement('div');
  masterDiv.style.position = "absolute";
  masterDiv.style.cursor = "pointer";
  masterDiv.style.overflow = "hidden";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
createElement
var div1 = document.createElement('div');
div1.style.position = "absolute";
div1.style.cursor = "pointer";
div1.style.overflow = "hidden";
ready
cloneNode
var div2 = masterDiv.cloneNode(true);
ready

Revisions

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