Closed
Bug 541805
Opened 16 years ago
Closed 16 years ago
Empty paragraph elements cause the margin to be rendered
Categories
(Core :: DOM: HTML Parser, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: dma_k, Unassigned)
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
When the HTML document with non-valid structure is loaded (which breaks the rule that inline elements should not contain block elements), the fall-back algorithm behaves somehow strange for the following case:
<p class="some class"> text1 <block>....</block> text2 </p>
- The text till block is splitted into independent para node: <p class="some class"> text1 </p>
- Then <block> follows
- Then hanging text follows "text2" [Strange, expected <p class="some class"> text2 </p>]
- The empty para node is created [Unexpected]
The problem is that empty para node does not inherit the class information and causes the additional margin (that depends on styles, of course, but in my case that is true).
As to the specification, empty para element should be ignored:
http://www.w3.org/TR/html4/struct/text.html#h-9.3.1
Reproducible: Always
> - The text till block is splitted into independent para node: <p class="some
> class"> text1 </p>
> - Then <block> follows
> - Then hanging text follows "text2" [Strange, expected <p class="some class">
> text2 </p>]
This is expected. The closing tag for P is optional, so the <ul> ends the P.
> - The empty para node is created [Unexpected]
This is the only part that seems like it could be a bug, but I think an unexpected </p> implies a <p> in other browsers as well.
> As to the specification, empty para element should be ignored:
> http://www.w3.org/TR/html4/struct/text.html#h-9.3.1
Based on discussions with the HTML working group, this is intended to say that it should not create additional vertical space (which is accomplished by CSS margin collapsing). It is not intended to say anything about the parse tree.
Component: Layout: Block and Inline → HTML: Parser
QA Contact: layout.block-and-inline → parser
HTML5 requires </p> when not inside a P to imply a start tag:
http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody says:
# An end tag whose tag name is "p"
#
# 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; act as if
# a start tag with the tag name "p" had been seen, then reprocess the
# current token.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•