twey vs bennylava

Benchmark created on


Description

to the pain

Preparation HTML

<div id="mContainer">
  </foo>

Setup

var mContainer = document.getElementById('foo');

Teardown


    mContainer.innerHTML = "";
    delete mContainer;
  

Test runner

Ready to run.

Testing in
TestOps/sec
innerhtml
mContainer.innerHTML = "<div id=\"myDiv\"><a href=\"http://slayeroffice.com\" onmouseover="
doStuff();
">hello world</a></div>";
ready
dom
// create a DIV element, using the variable eDIV as a reference to it
eDIV = document.createElement("div");
//use the setAttribute method to assign it an id
eDIV.setAttribute("id", "myDiv");
// create your anchor element
eAnchor = document.createElement("a");
// set its href attribute with the setAttribute method
eAnchor.setAttribute("href", "http://slayeroffice.com");
// add our event handler to the anchors mouseover event
eAnchor.onmouseover = doStuff;
// add the text "hello world" to the anchor element
eAnchor.appendChild(document.createTextNode("hello world"));
// append your newly created anchor element to the div
eDIV.appendChild(eAnchor);
// append your newly created DIV element to an already existing element.
mContainer.appendChild(eDIV);
ready

Revisions

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