W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2000

RE: bug in handling </p> inside <table>

From: Jelks Cabaniss <jelks@jelks.nu>
Date: Tue, 25 Jul 2000 15:00:11 -0400
To: <html-tidy@w3.org>
Rick Parsons wrote:

> >  <!ELEMENT TABLE - -

> I can see Stuart's point that P is not allowed in TABLE but if he is right
> in listing the only things allowed within a TABLE, why doesn't Tidy insert
> the TBODY where it is needed rather than let the browser imply it which
> always seems to be a dangerous thing to do?

To be precise, the *browser* isn't what implies it, the HTML 4 DTD does by the
rules of SGML (just as it "implies" HTML, HEAD, and BODY elements, by saying
that Start tags and End tags are both omissible and are to be inferred by the
content within in them).  For example, running a document containing


through sgmlnorm [1] will output a new document containing


XML doesn't allow you to infer anything of the sort (making an XML parser a lot
easier to write than an SGML parser).  So the XHTML 1.0 DTD is slightly

    <!ELEMENT table
       (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>

Notice how it specifies that a table could have just one tbody **OR** one tr as
a direct child!

At any rate, you don't need to specify tbody either in HTML 4 (where it's
implied), or in XHTML 1 (where it's just optional).  Let the author decide.  In
either case, it shouldn't be considered "dangerous" to omit it -- by convention,
even the oldest browsers ignore elements they don't understand -- they ignore
tbody if it's there, and don't get upset if it isn't.


[1] http://www.jclark.com/sp/
Received on Tuesday, 25 July 2000 15:03:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:48 UTC