W3C home > Mailing lists > Public > www-validator@w3.org > September 2002

Re: BASE and IMG and [X]HTML

From: Nick Kew <nick@webthing.com>
Date: Mon, 23 Sep 2002 23:02:37 +0100 (BST)
To: kynn@idyllmtn.com
cc: Charlie Reiman <creiman@kefta.com>, www-validator@w3.org
Message-ID: <Pine.LNX.4.21.0209232254001.1149-100000@jarl.webthing.com>

On Mon, 23 Sep 2002 kynn@idyllmtn.com wrote:

> Charlie Reiman asked:
> > We've been having a discussion on the zope mailing list regarding the
> > validator's behavior with <base ... />. In particular, an HTML 4.01
> > transitional document is not allowed to use <base ... />. Instead, it is
> > expected to use <base ...>.

Yes, that's SGML syntax for an empty element.

> > Well, okay. I don't like it but I accept the reasoning. But why does it not
> > complain about <img ... />? Isn't this the same situation?

Yes, but not for the reason you think.

The / closes the tag in both cases, so the ">" is simply a character.
In HTML 4.01 Legacy loose character data is allowed in the <body>
(where <img...> appears) but not in <head ...> (so it is illegal
with <base...>).

This means you will get confusing error messages when you validate,
and is one of many reasons to prefer strict over legacy HTML.

> /
>      Wait, what the heck is this?

SHORTTAG.  No problem there.

>      <img src="blah.jpg" alt="Blah!">/&gt;

Nope.  YM <img src="blah.jpg" alt="Blah!">&gt;

Look at the parse tree.  Or use Page Valet, which presents the same
results as the W3 validator but in a clearer manner.

Nick Kew
Received on Monday, 23 September 2002 18:02:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:58:29 UTC