|
Posted by TonyV on 01/08/08 16:53
On Jan 6, 12:24 pm, Michael Fesser <neti...@gmx.de> wrote:
> The DTD does (taken from XHTML 1.0):
>
> <!ELEMENT thead (tr)+>
> <!ELEMENT tfoot (tr)+>
> <!ELEMENT tbody (tr)+>
>
> At least one row is required in each row group.
> And the 'tr' element must contain at least one cell:
>
> <!ELEMENT tr (th|td)+>
Michael is correct. If I include a thead and tbody without a tfoot,
the page doesn't validate. Also, if I include a tfoot without a tr,
or a tfoot with a tr without a td, the page doesn't validate. It
doesn't make sense to me that every table *must* have a tfoot, and I
was just kind of wondering if anyone knew the rationale behind it, and
if there was some standard way people created tables with all three
elements when one or two of them don't have anything to display. I'm
getting the vibe that there's not, other than people simply ignoring
the standard.
On Jan 6, 12:24 pm, Michael Fesser <neti...@gmx.de> wrote:
> >I've read that in XHTML 1.1, if you have a thead and tbody, you *must*
> >have a tfoot.
>
> Where have you read that?
At the W3Schools site. It seems to be a very reliable reference that
I use all the time. Here's the specific link to the page:
http://www.w3schools.com/tags/tag_tbody.asp
In the tips and notes section, it says, "If you use the thead, tfoot
and tbody elements, you must use every element." I'm guessing that
they've parsed the DTD and this is how it's interpreted. The page not
validating seems to back it up.
On Jan 6, 2:15 pm, Sherman Pendley <spamt...@dot-app.org> wrote:
> In practice, it doesn't matter, since neither IE6 nor 7 has a real XHTML
> parser anyway. If you serve it as text/html, they'll display it, but they
> use their HTML parser to do it, treating the contents of your page as HTML
> and ignoring the extra slashes and unknown elements as part of its error
> handling.
>
> It won't validate, but validation isn't very useful for something that
> depends on IE's error correction to display properly in the first place.
This is true, the page will still render. However, I would really
like it to be coded according to the standards in place, even if I
don't agree with them. I've never been of the "work around the
standards if they don't suit your needs" philosophy; I think this is
one of the problems that has led to the numerous messes we're in now,
where companies or organizations just unilaterally decide that they're
going to do things their own way, and to hell with the standards.
Plus, there's the little matter that if the major browsers decide that
they will start enforcing all of these rules, something that does have
precedence, I'd like to make sure as much as possible that my code
still works without having to put in a bunch of if MyBrowser_v4 then
renderOneWay(); else if MyBrowser_v5 then renderAnother(); else
renderYetAnother(); kludges in.
On Jan 6, 11:59 am, Neredbojias <monstersquas...@yahoo.com> wrote:
> Yeah. I flip a tbird in the general direction of the w3c and eliminate the
> extraneous crap from the page.
As noted, I don't feel this is a practical long-term solution. In the
interest of my code working in future browsers that might enforce
adherence to the standards (which I wish they all did now), I won't be
"flipping a tbird in the general direction" of anyone.
Anyway, thanks for the answers, I guess I'll just include a tfoot
element with a tr and td that has no content. Empty tds don't render
anyway. I always thought that was weird, but I'm kind of glad now.
[Back to original message]
|