[whatwg] [WebApps] "html" start tag token in main phase

Ian Hickson ian at hixie.ch
Fri Dec 8 13:58:48 PST 2006

On Fri, 8 Dec 2006, J. King wrote:
> The root element phase dictates that any start tag (including "html") 
> produces an <html> element in the document and is then re-processed in 
> the main phase. The main phase then states that if an "html" start tag 
> token is encountered it produces a parse error -unless- it's the first 
> start tag.
> Wouldn't it be simpler to just properly process the "html" start tag in 
> the root element phase instead of having such a special case?  I'm 
> certainly finding this special case to be needlessly difficult to deal 
> with.

You can implement it as you wish, so long as the result is the same. The 
reason for doing it this way was so that there was only one place in the 
spec that generated the <html> node, and then one only place that dealt 
with <html> attributes. This was done because it was expected that most 
implementations would pre-fill the stack with the <html> element, and so I 
wanted to make very sure they all handled attributes on <html> the same.

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