New elements vs. Trident

While working on examples for the "Degrade Gracefullly" principle, I  
realized that IE's handling of unknown elements makes it somewhat  
challenging to do graceful degradation for any new elements.

Something like this:

<newelement><em>some text</em></newelement>

Creates a DOM like this:

BODY
     NEWELEMENT
     EM
         #text: some text
     /NEWELEMENT

In other words, instead of wrapping the unknown element around its  
contents, IE adds an empty elment named "NEWELEMENT" at the start tag,  
and another empty element named "/NEWELEMENT" at the end tag. (Note  
that this behavior is also in violation of HTML 4.01

http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A%3Chtml%3E%0D%0A%3Cbody%3E%0D%0A%3Cnewelement%3Esome%20text%3C%2Fnewelement%3E%0D%0A%0D%0A


This creates obvious problems with graceful degradation for new  
elements - it's not possible to style them, add event listeners, or in  
general work with them as expected in the DOM.

Fortunately, it's easier to do a script-based fixup since there is a  
marker for where the end of the element should have been in the DOM;  
apparently this was done before for the <abbr> element, which IE6  
handled as an unknown element: <http://dean.edwards.name/IE7/>.

However, it would be nice to avoid the need for such script hacks. Can  
anyone from Microsoft comment on the possibility of fixing the  
handling of unknown elements in IE, even well in advance of broader  
implementation of HTML5?

Regards,
Maciej

Received on Sunday, 16 September 2007 06:50:04 UTC