[whatwg] Scoping elements and nested paragraphs

Ian Hickson ian at hixie.ch
Mon Dec 1 20:05:59 PST 2008


On Wed, 12 Nov 2008, Tommy Thorsen wrote:
>
> Consider the following markup:
>    <p><object><p>X</p></p>
> 
> The html5 parsing algorithm produces the following tree:
>    <html><head></head><body><p><object><p>X</p><p></p></object></p></body></html>
> 
> whereas Firefox and Opera both produce:
>    <html><head></head><body><p><object><p>X</p></object></p></body></html>
> 
> and IE produces:
>    <html><head></head><body><p><object></object></p></body></html>
> 
> The main problem with the html5 output, in my opinion, is the extra <p></p>
> inside the <object>. This happens because <object> is a scoping element and
> the final </p> is not able to find the first <p>.
> 
> I've fixed this in our implementation by implementing the first paragraph in
> 'An end tag whose name is "p"' in "in body" as if it said:
> 
> ---
> If the stack of open elements does not have an element in scope  with the same
> tag name as that of the token, then this is a parse error
> 
> If the stack of open elements does not contain an element with the same tag
> name as that of the token, then act as if a start tag with the tag name p had
> been seen, then reprocess the current token.
> ---

I don't really see this as a critical issue; did this break any pages? 
Since WebKit does what HTML5 does here, I've left the spec as is.

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