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

[whatwg] Scoping elements and nested paragraphs

From: Tommy Thorsen <tommy@kvaleberg.com>
Date: Wed, 12 Nov 2008 10:49:03 +0100
Message-ID: <491AA68F.7070807@kvaleberg.com>
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.
---


Best regards,
Tommy
Received on Wednesday, 12 November 2008 01:49:03 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:07 UTC