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 | 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.innerHTML = i;
div.appendChild(span);
outerdiv.appendChild(div);
}
| ready |
100 element createElement bulk add - textnode | 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');
span.appendChild(document.createTextNode(i));
div.appendChild(span);
outerdiv.appendChild(div);
}
container.appendChild(outerdiv);
| ready |
100 element createElement bulk add - textContent | 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');
span.textContent = i;
div.appendChild(span);
outerdiv.appendChild(div);
}
container.appendChild(outerdiv);
| ready |
100 element createElement bulk add - innertext | 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');
span.innerText = i;
div.appendChild(span);
outerdiv.appendChild(div);
}
container.appendChild(outerdiv);
| ready |
Document Fragment | var fragment = document.createDocumentFragment();
for (var i = 0; i < 100; i++) {
var div = document.createElement('div');
var span = document.createElement('span');
span.innerText = i;
div.appendChild(span);
fragment.appendChild(div)
}
document.getElementById('container').appendChild(fragment)
| ready |