100 element innerHTML | var innerHTMLstr = '<div>';
for (var i = 0; i < 100; i++) {
innerHTMLstr += '<div><span>' + i + '</span></div>';
}
innerHTMLstr += '</div>';
document.getElementById('container').innerHTML = innerHTMLstr;
| ready |
100 element createElement added in sequence late | var container = document.getElementById('container');
var outerdiv = document.createElement('div');
container.appendChild(outerdiv);
for (var i = 0; i < 100; i++) {
var div = document.createElement('div');
var span = document.createElement('span');
span.appendChild(document.createTextNode(i));
div.appendChild(span);
outerdiv.appendChild(div);
}
| ready |
100 element createElement bulk add | var container = document.getElementById('container');
var outerdiv = document.createElement('div');
for (var i = 0; i < 100; i++) {
var div = document.createElement('div');
var span = document.createElement('span');
var text = document.createTextNode(i)
span.appendChild(text);
div.appendChild(span);
outerdiv.appendChild(div);
}
container.appendChild(outerdiv);
| ready |
100 element createElement added in sequence early | var container = document.getElementById('container');
var outerdiv = document.createElement('div');
container.appendChild(outerdiv);
for (var i = 0; i < 100; i++) {
var div = document.createElement('div');
outerdiv.appendChild(div);
var span = document.createElement('span');
div.appendChild(span);
var text = document.createTextNode(i);
span.appendChild(text);
}
| ready |
100 element createDocumentFragment | var container = document.getElementById('container');
var outerdiv = document.createElement('div');
var fragment = document.createDocumentFragment();
var div = document.createElement('div');
var span = document.createElement('span');
for (var i = 0; i < 100; i++) {
span.textContent = i;
outerdiv.appendChild(fragment.cloneNode(true));
}
container.appendChild(outerdiv);
| ready |