Re: validator failed to spot error, that msie did not.

On Thu, 18 Nov 2004, TJ wrote:

> I'm not sure if the validator is supposed to spot
> this type of typo but any way heres my story...

It is not.

> I was writting a php app, that generated a table,
> out of a loop.

Normally you should post the URL of a problematic document. This is an
exceptionally lucky case where the problem and solution can be identified
without a URL (but you didn't know that in advance).

> I got:
>
> "This Page Is Valid HTML 4.0 Strict!"

That's what the validator unfortunately says. It just tries to be helpful,
you know. What it should say is that the document is valid, period. But
this is a general problem.

> But msie was still rendering it incorrect, so I blamed Microsoft
> (as you do... =)

I don't know who blames Microsoft for what, but objectively, what Internet
Explorer does here is a violation of HTML specifications _and_ it is a
violation shared by virtually all other browsers as well. They fail to
honor the SHORTTAG features of SGML, which are part HTML as defined in the
specifications from HTML 2.0 to HTML 4.01. I'm pretty sure there's
something about this in the validator's FAQ, though in a different
wording... wait a sec... yep:
http://validator.w3.org/docs/help.html#faq-typo

> But later I noticed, a silly typo.. a > was missing, I had "</TD"
> and not </TD>.

In practical terms, it surely was a typo. In SGML terms, no.

> I can understand firefox and konqueror correcting this,

I don't. As far as I know, they don't implement SHORTTAG features.
They are probably sloppy rather than formally correct here:
they simply ignore the stuff they can't parse, or they stop parsing an end
tag in a way that accidentally coincides with correct SHORTTAG processing.

> although
> I wish you could disable that ability for testing.

There was a "fussy" parsing mode that intentionally did not do correct
SHORTTAG processing, but http://validator.w3.org/whatsnew.html says
(with date label 2004-04-15):
"The "fussy" parsing mode is no longer available and will be drastically
improved before it comes back - if ever"

You might consider using http://www.htmlhelp.com/validator/
which issues (optionally) _warnings_ about using SHORTTAG features
when they are probably typos in practical terms. Here's an example of its
report:

<tr><td>foo</td <td>bar</td></tr>
                ^Warning: unclosed end-tag

(The "^" symbol relates to the "<" of the next tag, since it's really that
character that terminates, by SGML rules, the tag that had been opened but
not closed.)

> </TD is not valid text (because of <), it is not a valid tag,
> and every row in the table had an unclosed <TD>

In HTML up to HTML 4.01, </TD is a valid short form of </TD>
in certain conditions, which were fulfilled.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Friday, 19 November 2004 09:57:51 UTC