function replaceHtml(el, html) {
var oldEl = typeof el === "string" ? document.getElementById(el) : el;
/*@cc_on // The original innerHTML performs better in IE
oldEl.innerHTML = html;
return oldEl ;
@*/
var newEl = oldEl.cloneNode(false);
newEl.innerHTML = html;
oldEl.parentNode.replaceChild(newEl, oldEl);
/* Once we Remove the old element from the DOM and return the new element reference. */
return newEl;
};
There is still performance improvement for Opera, but the improvement is not as amazing as the above two browsers.
Only in IE, The original innerHTML method is more efficient.