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

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

The parser has been so defined. I still have to write the syntax part that 
defines this for authors, but it will include such prose as well.


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

(assuming a correct DOCTYPE):

  #document
    DOCTYPE
    HTML
      HEAD
        TITLE
          #text (Foo)
        SCRIPT
    BODY


> ... and this:
> 
>  <script type="text/javascript" src="bar"></script>
>  <title>Foo</title>

(assuming a correct DOCTYPE):

  #document
    DOCTYPE
    HTML
      HEAD
        SCRIPT
        TITLE
          #text (Foo)
    BODY


> ..? 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.
> 
> Is there a BODY element in this document (or, is there always a body
> element?):
> 
>  <style type="text/css">
>   body{ background:lime }
>  </style>

Yes; there is always a body element (assuming, again, a correct DOCTYPE is 
included).


> ... or this:
> 
>  <title>Bar</title>

Same.


> 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 terms of the parsing, this in now done. Please let me know if I omitted 
something. I'll write the author side of this in due course (which should 
be much simpler... I hope).

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

Received on Thursday, 23 February 2006 18:25:14 UTC