W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2005

[whatwg] [html5] tags, elements and generated DOM

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Tue, 05 Apr 2005 20:20:54 +1000
Message-ID: <42526686.6050001@lachy.id.au>
Anne van Kesteren wrote:
> I was wondering if HTML5 (WA1, at the moment) is going to define which 
> tags are optional and which elements are implied. (This is of course 
> only for text/html documents.)
> For example, what is the resulting DOM of this document:
>  <title>Foo</title>
>  <script type="text/javascript" src="bar"></script>

For this, there is no implied body, as there is no element to imply it. 
  SGML rules apply here, as they are expressed in the DTD, and I don't 
think HTML 5 should change them.  The resulting DOM will be the same as 
that for an HTML 4 document, which is:

>  <script type="text/javascript" src="bar"></script>
>  <title>Foo</title>

Same as above, with the title and script elements swapped.

> ..? Are both part of the implied HEAD element


>  or is the SCRIPT element in the first example perhaps part of the BODY element?


> I believe both are possible.

Both are possible, but since script is allowed within the content of the 
head element, its presence does not imply </head> and <body>.  End tags 
are implied after encountering content which is not allowed within the 

> Is there a BODY element in this document (or, is there always a body 
> element?):
>  <style type="text/css">
>   body{ background:lime }
>  </style>
> ... or this:
>  <title>Bar</title>

No, there is no implied body element in either of those fragments.

Run all of your examples through the validator, with the the Show Parse 
Tree option selected and see for yourself.  The rules for an HTML 5 
document will be the same as HTML 4.


Lachlan Hunt
http://GetFirefox.com/     Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Received on Tuesday, 5 April 2005 03:20:54 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:40 UTC