Re: Implied end of HEAD element

You wrote:
> What determines the end of the HEAD element if the end (and
> beginning) tags are omitted?

The start of BODY, implied or explicit.

> I had understood that it was the presense of elements not
> found in %head.content + %head.misc that signalled the end
> of the HEAD element, but when I feed the validator the
> following file (found at http://www.kynn.com/test.html):
>
>   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
>             "http://www.w3.org/TR/REC-html40/strict.dtd">
>   <TITLE>This is an example of poor HTML</TITLE>
>   <BR>
>   <LINK REL="stylesheet" TYPE="text/css" HREF="style.css">
>   <BODY>
>     <P>This is an example of poor HTML</P>
>   </BODY>
>
> I get this error:
>
> Error at line 4:
>      <BR>
>       ^  document type does not allow element "BR" here

My understanding is the occurence of BODY determines the end of HEAD so
the validator is justified in indicating an error.  BR is not allowed in
the head.  HTML's start is implied, as is HEAD and BODY, all by what
elements you put, and where you put them.

BTW, in HTML 4.0 Strict, BR is not allowed outside of a %block element
such as P or DIV, so that is another thing that really adds to the mix.
In fact, I think that's why the validator flags BR as "out-of-place".
If you had something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<TITLE>This is an example of poor HTML</TITLE>
<p><br></p>
<LINK REL="stylesheet" TYPE="text/css" HREF="style.css">
<BODY>
<P>This is an example of poor HTML</P>
</BODY>

...maybe it would shed some more light on the situation, and it may even
flag LINK as errant, which is what you were expecting.

> My expectation was that the <BR> would signal the end of the
> HEAD element,

It does, and now I can see where the confusion is.

> and <BR> would pass fine, <LINK> would get flagged
> as something that doesn't belong in a BODY element, and <BODY>
> would get flagged because there's already a BODY element that
> started when the <BR> was encountered.

I think the validator only mentions the first error encountered if the
other errors are caused by previous mistakes.  That's why you don't see
BODY flagged as an error.  If you lose the BR, BODY is just fine where
it is, so theoretically, there isn't even any need to flag BODY.

> Is this simply my misunderstanding of what should be happening?
> If so, please illuminate me on how implied tags work. :)

Well, I talked a little about implied elements above.  HTH!  ;-)

--
 -Ryan Fischer <fischer@email.unc.edu> ICQ UIN - 595003

Received on Thursday, 29 July 1999 22:08:53 UTC