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:
html
|
+-head
   |
   +-title
   +-script

>  <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

Yes.

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

No.

> 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 
element.

> 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.

http://validator.w3.org/fragment-upload

-- 
Lachlan Hunt
http://lachy.id.au/
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.3.1 : Monday, 13 April 2015 23:08:21 UTC