Theresa O’Connor

DOM Consistency

This is in reply to Sam Ruby’s HTML Reunification—go read that first. (When I tried to post this as a comment, his comment system didn’t seem to be working.)

As a web developer, one of the most appealing (if not the most appealing) parts of HTML5 as currently defined is that HTML is a DOM language with two serializations. I don’t have to care if the browser (or other tool) used an XML parser or an HTML parser, because I can write code that works on the DOM that comes out at the other end. This applies to both browser-based scripting as well as other tools I write that process web content (thank you, html5lib).

Whenever the DOM differs between the two serializations, web developers suffer. Their code grows different code paths, etc. Basically, the DOM Consistency principle is probably the most important of the design principles from the perspective of someone doing serious DOM scripting in modern web applications. The extent to which other technologies intended to be part of the web platform strain this principle is the extent to which they are unsuited to be part of the web platform.

Don’t relax the DOM Consistency principle. That would be bad.