[whatwg] Handling <title> inside <body>

Ian Hickson ian at hixie.ch
Mon Nov 10 07:59:54 PST 2008


On Mon, 10 Nov 2008, Tommy Thorsen wrote:
>
> I don't care very strongly about whether or not title elements are 
> allowed anywhere, but I do think the output of the parsing algorithm 
> should be valid html according to the rest of the spec. So, in my 
> opinion, we need to change either the allowed context of the title 
> element, or the parsing algorithm.

There are a bazillion ways in which the parser algorithm will result in 
non-conforming DOM trees given non-conforming input. There's not really 
any way we can change that given our constraints of being compatible with 
legacy markup.


> FWIW: In our implementation, I've changed the handling of "base" and 
> "title" in "in body" to:
> 
>    Process the token using the rules for the "after head" insertion 
>    mode.
> 
> instead of processing them with the rules for "in head".

Unless there are pages that depend on this (are there?), I'm very 
reluctant to change the spec in this way.


On Mon, 10 Nov 2008, Tommy Thorsen wrote:
> 
> From an implementors point of view, it's good to have clearly defined 
> boundaries between modules. An implementation would typically have one 
> module that tokenises and parses html and one module that renders the 
> resulting dom to the screen. If all the unexpected input is dealt with 
> in the parsing module, then you can make some assumptions in the 
> rendering module which can greatly simplify the implementation. Having 
> to deal with an arbitrary amount of illegal input in either module is, 
> IMHO, not the ideal design.

Unfortunately, we have little choice in the matter. Scripting and XML both 
allow you to unambiguously create highly non-conforming DOMs, e.g. with 
<title> elements as the root element and <html> elements as children of 
<input> elements. The renderer has to deal with all such DOMs.

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