[whatwg] Parsing the string <html>

Ian Hickson ian at hixie.ch
Fri Aug 2 16:04:58 PDT 2013


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