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

Ian Hickson ian at hixie.ch
Tue Apr 5 04:17:04 PDT 2005


On Tue, 5 Apr 2005, 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.)

Yes.


> For example, what is the resulting DOM of this document:
> 
>  <title>Foo</title>
>  <script type="text/javascript" src="bar"></script>
> 
> ... and this:
> 
>  <script type="text/javascript" src="bar"></script>
>  <title>Foo</title>
> 
> ..?

If I am not mistaken:

   <html><head><script.../>
   <title.../></head><body></body></html>


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

This is not ambiguous in SGML, which defines this in detail.


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

In HTML4 those are invalid (<body> can't be empty). The <body> will always 
e implied, though. (For backwards compatibility with legacy parsers, the 
<head> probably won't be.)


> Is HTML5 going to list which start- and endtags are optional and how the 
> resulting DOM tree should look like in situations were there are 
> multiple options?

In HTML4 there are never multiple options, but the answer to your question 
is yes.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list