Re: Too much info on auto-closing META tags - confusing

On Mon, 18 Oct 2004, David Dorward wrote:

[warning: pedantry follows]
> > My question is: are auto-closing META tags like this
> >
> > <meta name="x" content="x" />
> >
> > valid HTML 4.01 strict (even if the W3 validator says they aren't)?

No, that's invalid.

> The long answer is that it may or may not be *valid* depending on
> where you use it.

He said HTML strict.  The remainder of your reply applies to legacy,
not to strict.

> In HTML <foo /> (effectively) means the same as <foo>&gt;.

Or rather <foo >> , where the final > is character data.

> Character data (i.e. &gt; or 'Hello, world') is not allowed within the
> <head>.

Nor in <body> (in strict).  It has to go inside an appropriate container.

> However, the end tag for head and the start tag for body are optional.
>
> So this is valid:

HTML-loose yes; strict no.
>
> <title>Foo</title>
> <meta name="x" content="x" />
> <h1>Wibble</h1>
>
> as it means the same as
>
> <head>
> <title>Foo</title>
> <meta name="x" content="x">
> </head><body>
> &gt;
> <h1>Wibble</h1>

More pedantry: that's not equivalent even in loose.  You introduced
whitespace at the top of the <body>.

> The only browser I know that might respect this is Emacs w3-mode, so

I expect an SGML browser would too, but I seem to have mislaid my QWeb:-)

-- 
Nick Kew

Received on Monday, 18 October 2004 18:03:19 UTC