I\'m trying to set a huge (200K) response to innerHTML of a node. The goal is to get better time than 2.7 sec in Internet Explorer 6.
Any ideas?
I've heard that innerText
is about two times faster than innerHTML
in IE. Not sure if it's true, though, but it might be worth a try.
if (window.ActiveXObject) { // we're using IE
document.getElementById('myElement').innerText = 'Bla bla bla bla';
// or create a textnode:
var txt = document.createTextNode('Lorem ipsum');
document.getElementById('myElement').appendChild(txt);
} else {
// other code here
}
Update: Note that if you want to modify the HTML of myElement
, don't use innerText
– the HTML will be visible in plain text, like if you were using <
and >
.