[whatwg] Parsing the string <html>

Mohammad Al Houssami (Alumni) mha53 at mail.aub.edu
Fri Aug 2 17:08:48 PDT 2013

That is totally correct. But are the head and body elements added to the document? So basically when we stop parsing the document should only have the html element is that correct? 

-----Original Message-----
From: Ian Hickson [mailto:ian at hixie.ch] 
Sent: Saturday, August 03, 2013 12:05 AM
To: Mohammad Al Houssami (Alumni)
Cc: whatwg at whatwg.org
Subject: Re: [whatwg] Parsing the string <html>

On Fri, 2 Aug 2013, Mohammad Al Houssami (Alumni) wrote:
> When parsing the string <html> the document should supposedly have an 
> html root with head and body children. ( This is what live dom viewer 
> shows at least) but according to the specs( if im not wrong) we only 
> get the document with the html element and the stack of open elements 
> will have html head and body elements in it.

The "<html>" start tag token causes you to jump from the "initial" 
insertion mode to the "before html" insertion mode, and then the <html> element is created and you jump to "before head".

You then hit the "end of file" token, and that causes the <head> element to be generated, and switches you to "in head", where <head> is popped and you switch to "after head", where you insert a <body> element and switch to "in body", at which point you stop parsing.

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