W3C home > Mailing lists > Public > www-html@w3.org > January 2003

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

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 7 Jan 2003 08:19:11 +0000 (GMT)
To: David Woolley <david@djwhome.demon.co.uk>
Cc: "www-html@w3.org" <www-html@w3.org>
Message-ID: <Pine.LNX.4.21.0301070816370.4082-100000@dhalsim.dreamhost.com>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:53 GMT