1000 element string innerHTML | var innerHTMLstr = '<div>';
var i;
for (i = 0; i < 1000; i++) {
innerHTMLstr += '<div><span>' + i + '</span></div>';
}
innerHTMLstr+='</div>';
document.getElementById('container').innerHTML = innerHTMLstr;
| ready |
1000 element innerHTML | var container = document.getElementById('container');
var outerdiv = document.createDocumentFragment();
var i, div, span;
for (i = 0; i < 1000; i++) {
div = document.createElement('div');
span = document.createElement('span');
span.innerHTML = i;
div.appendChild(span);
outerdiv.appendChild(div);
}
container.appendChild(outerdiv);
| ready |
1000 createTextNode | var container = document.getElementById('container');
var outerdiv = document.createDocumentFragment();
var i, div, span;
for (i = 0; i < 1000; i++) {
div = document.createElement('div');
span = document.createElement('span');
span.appendChild(document.createTextNode(i));
div.appendChild(span);
outerdiv.appendChild(div);
}
container.appendChild(outerdiv);
| ready |
1000 element textContent | var container = document.getElementById('container');
var outerdiv = document.createDocumentFragment();
var i, div, span;
for (i = 0; i < 1000; i++) {
div = document.createElement('div');
span = document.createElement('span');
span.textContent = i;
div.appendChild(span);
outerdiv.appendChild(div);
}
container.appendChild(outerdiv);
| ready |
1000 element innerText | var container = document.getElementById('container');
var outerdiv = document.createDocumentFragment();
var i, div, span;
for (i = 0; i < 1000; i++) {
div = document.createElement('div');
span = document.createElement('span');
span.innerText = i;
div.appendChild(span);
outerdiv.appendChild(div);
}
container.appendChild(outerdiv);
| ready |
1000 element string innerHTML [concat] | var out = ['<div>']
var i;
for (i = 0; i < 1000; i++) {
out.push('<div><span>');
out.push(i);
out.push('</span></div>');
}
out.push('</div>');
document.getElementById('container').innerHTML = out.join('');
| ready |