Re: [x]html head parsing bug in validator

On Sat, 26 Apr 2003, Gabor Hojtsy wrote:

> Brrrrr, <link can be closed with / ??

Yes, as any element, by the rules that validators check against.

> What standard says, that a tag can be closed with / alone?

The SGML standard, ISO 8879.

> <body><img src="http://www.w3.org/Icons/valid-xhtml10" alt="xhtml"/><hr
> /></body>
>
> This also validates as HTML 4.01.

Yes, as HTML 4.01 Transitional, and it is equivalent to
<body><img src="http://www.w3.org/Icons/valid-xhtml10"
alt="xhtml">><hr>></body>

The reason you don't see those >'s rendered is that browsers (except for a
few exotic exceptions) do not process HTML correctly - any version of
HTML. That's one reason why XHTML was developed; it is retrofitted to the
simple non-SGML parseres that browsers contain.

> None of the <img/> or <hr/> tags close the
> body, or anything...

Why should they? Character data, such as ">" is allowed in <body>.

> Excuse me, but I don't understand this.

You're not alone.

> / in a <link> is interpreted as the
> end of the link, while / in an <img>, <hr>, <br>, etc. is not considered end
> of the tag?

No, by SGML rules, as formally applied in HTML, it terminates the element.
What matters in validation is whether character data (the ">" character)
is accepted in the context.

There's a long explanation at
http://www.cs.tut.fi/~jkorpela/html/empty.html
but the bottom line is:
If you move from HTML to XHTML, do so completely, for any given document.
In-between syntax typically results in something that is invalid under
_both_ HTML _and_ XHTML specifications.

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

Received on Saturday, 26 April 2003 13:40:07 UTC