Re: Minimized tags error

Christian Smith <csmith@barebones.com> wrote:

> Why is the validator passing this as valid?

Because this is not invalid.

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
>     <head>
>         <title>Sidebar</title>
>     </head>
>     <body>
>         <p>
>         252 Riddle Pond Road<br />
>         WTopsham VT 05086<br />
>         </p>
>     </body>
> </html>
> 
> This looks like a bug to me. <br /> is an XHTML formatted tag and doesn't
> belong in an HTML document.

The SGML declaration of HTML 4.01 says "SHORTTAG YES", which allows
this kind of shorthand markup.  However, in this case the null end-tag
(NET) delimiter is "/", so ">" is just treated as character data.
In other words, "<br />" is an equivalent of "<br>>" in this case.

Try the validator with "Show parse tree" option, then you'll see
that ">" after "<br /" is not parsed as part of markup but as just
a character in the parse tree.

Regards,
-- 
Masayasu Ishikawa / mimasa@w3.org
W3C - World Wide Web Consortium

Received on Tuesday, 27 March 2001 18:32:15 UTC