Friday, March 6th, 2009>p>Just when you started having fun with innerHTML, you discovered that on IE, various table-related elements can’t be modified with it. Ever wonder why? Eric Vasilik is the developer responsible for that “feature” of IE, and he came clean about it several years ago:
We never had enough time to implement such a feature. And, in order to deal with attempts to modify tables in such a manner, I prohibited the modification of tables with innerHTML and other methods.
An alternative to all this would have been to “hack” something up. For example, I could have checked to see if the innerHTML of a TBODY was being set to something which began with a “
“. Under these circumstances I could have prepended a “
” to the string, and then plucked the TR’s out of the resulting tree and replaced the contents of the TBODY with them.
Sounds simple enough until you have to consider all the variations. Like, what if the string to be parsed looks like “
…”. Pretty soon you start doing all the work the real parser has to do.
So instead of hacking up something very incomplete and possibly erroneous in many cases, I left the modifications of tables with innerHTML out of the product.
The full blog entry goes into a bit more detail and is fairly interesting. Also, be sure to check out the post on easter eggs in early versions of IE.
Posted by Ben Galbraith at 8:00 am