W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2008

[whatwg] Scoping elements and nested paragraphs

From: Tommy Thorsen <tommy@kvaleberg.com>
Date: Tue, 02 Dec 2008 09:05:44 +0100
Message-ID: <4934EC58.2050700@kvaleberg.com>
Ian Hickson wrote:
> 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.
>
>   

This does not, as far as I know, break any real pages. We did discuss 
the issue in the irc-channel after I sent this mail 
(http://krijnhoetmer.nl/irc-logs/whatwg/20081112#l-285 and onwards) and 
we came to the same conclusion as you. I've reverted the change I did to 
our parser so that we follow the specification.

regards,
Tommy
Received on Tuesday, 2 December 2008 00:05:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:46 UTC