Re: HTML or XHTML - why do you use it?

On Tue, 7 Jan 2003, David Woolley wrote:
>>
>>    explicitly include <tbody> elements
> 
> I don't understand this one.  Surely the DOM for an HTML table always contains
> tbody's as tr is not allowed as a direct descendant of table, so a proper
> DOM has to include tbody elements, and that is what gets styled.

In XHTML, <tbody>s are optional. In HTML, they are required, but their
start and end tags are optional. This means that the following:

   <table>
    <tr>
     <td> </td> 
    </tr>
   </table>

...is valid in both, but different CSS rules match depending on the parse
mode:

   table > tr > td::before { content: 'Parsed as XHTML'; }
   table > tbody > tr > td::before { content: 'Parsed as HTML'; }

Similar (but even harder to track down) problems occur with DOM that
navigates through tables without realising that this difference exists.

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 7 January 2003 03:19:13 UTC