Re: Formal definition of HTML5 (was Re: Version information)

David Dailey wrote:
> The W3C spec says
> "The <http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY>TBODY 
> start tag is always required except when the table contains only one 
> table body and no table head or foot sections.

Right.  When the start tag is not required, it is implied.

In particular, the DTD for HTML 4 says:

<!ELEMENT TABLE - -
      (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>

which means <table> is allowed to contain an optional caption, some col/colgroup 
tags, an optional thead, an optional tfoot, and tbody tags.  It is NOT allowed 
to directly contain <tr>, for example.

At the same time, the DTD says

   <!ELEMENT TBODY    O O (TR)+           -- table body -->

Which means that the <tbody> element has optional start and end tags and is 
allowed to contain <tr> elements.  The prose then further restricts when the 
start tag is optional.

If an optional start tag is missing, the parser is required to synthesize it, as 
I understand SGML.

This is actually one area of serious incompatibility between HTML4 and XHTML1 
(in the latter, the tbody is well and truly optional, which means the same 
well-nested markup leads to a different DOM).

-Boris

Received on Tuesday, 17 April 2007 16:49:38 UTC