Thursday, April 27, 2006

Robert’s talk » We all love innerHTML

Robert’s talk » We all love innerHTML: "We all love innerHTML
Published on Thursday, April 20th, 2006

This article is co-written with Anne van Kesteren, W3C Member and contributor to the WHATWG and Opera specifications, R&D and QA person.

When developing a web page, DOM methods are generally the way to go when dynamically altering elements’ attributes and performing other operations. But what about adding content to a web page in the most efficient manner, both code- and performance wise? We claim that innerHTML is unmatched by any DOM methods available and that it is in most, if not all, situations the best option."

I have to say that innerHTML is easy to use - just a quick little one-liner, but I usually use DOM methods, as I think nthey are cleaner. I just with the DOM methods were faster!

The fact that innerHTML is quicker becomes important the more frequently it is used, in AJAX applications that may become more important.

No comments: