100 element innerHTML | var container = document.getElementById('container');
for (var i = 0; i < 100; i++) {
var div = document.createElement('div');
div.innerHTML = '<div><span>' + i + '</span></div>';
container.appendChild(div);
}
| ready |
100 element deep cloneNode bulk add | var container = document.getElementById('container');
var outerdiv = document.createDocumentFragment();
var protodiv = document.createDocumentFragment();
var protospan2 = document.createElement('div');
var protospan3 = document.createElement('div');
var protospan = document.createElement('span');
protospan2.appendChild(protospan);
protospan3.appendChild(protospan2);
protodiv.appendChild(protospan3);
for (var i = 0; i < 100; i++) {
var div = protodiv.cloneNode(true);
div.childNodes[0].childNodes[0].childNodes[0].innerHTML = i;
container.appendChild(div);
}
| ready |
100 element create fragment | var container = document.getElementById('container');
var outerdiv = document.createDocumentFragment();
for (var i = 0; i < 100; i++) {
var protodiv = document.createDocumentFragment();
var protospan2 = document.createElement('div');
var protospan3 = document.createElement('div');
var protospan = document.createElement('span');
protospan2.appendChild(protospan);
protospan3.appendChild(protospan2);
protodiv.appendChild(protospan3);
protospan.innerHTML = i;
container.appendChild(protodiv);
}
| ready |
100 element create | var container = document.getElementById('container');
var outerdiv = document.createDocumentFragment();
for (var i = 0; i < 100; i++) {
var protospan2 = document.createElement('div');
var protospan3 = document.createElement('div');
var protospan = document.createElement('span');
protospan2.appendChild(protospan);
protospan3.appendChild(protospan2);
protospan.innerHTML = i;
container.appendChild(protospan3);
}
| ready |