My Location

Mar 2, 2009

innerHTML and tables in IE

I have been doing some work on the performance of dynamically-created tables in our web application framework (which only works in IE). I used this QuirksMode performance comparison of innerHTML and the DOM as the basis for my work. Our framework was building the table using DOM methods inside loops, and I rewrote it using the array push/innerHTML method.

Rather than build an HTML string for the entire table, I attempted initially to build a string containing the <TR>s and set table.tBodies[0].innerHTML. This led me to discover that innerHTML is read-only on table elements in IE. How bloody typical. So I had no choice but to do the entire table.

UPDATE: This work turned out to be extremely successful and has made a huge improvement in the performance of our application.

No comments:

Post a Comment