Closed Bug 208703 Opened 21 years ago Closed 21 years ago

<table> should close <p> in strict mode

Categories

(Core :: DOM: HTML Parser, defect)

x86
All
defect
Not set
minor

Tracking

()

VERIFIED DUPLICATE of bug 91927

People

(Reporter: mozilla, Assigned: harishd)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313

For pages with an unclosed <p> immediately prior to a <table>, a user style
sheet that specifies the max-width of <p> elements in em units is also applied
to the following table.

Reproducible: Always

Steps to Reproduce:
1. Create a user stylesheet containing the following rule:
p {max-width: 20em !important;}

2. Create a HTML page containing the following:
<p>
<table>
<tr>
<td>Some very boring, long-winded text.</td>
<td>More long and boring text, enough to make the table wider than 20em.</td>
</tr>
</table>

3.  View the HTML page while using the user style sheet.

Actual Results:  
The max-width rule is applied to the <table>

Expected Results:  
The <table> element should implicitly close the <p> element, therefore any style
rules applied to the <p> should NOT be applied to the following <table>.
can you attach a testcase and make sure you can reproduce this issue with latest
1.4 build ?
After more research, it seems that it is irrelevant whether the max-width
setting is done in a user style sheet or done inline.  The following HTML file
should indicate the problem:

<html>
<head>
<title>Max-width test</title>
</head>
<body>

<h1>Max-width test (in ems)</h1>

<p style="max-width:10em;">This paragraph is unclosed, but the following table
should close it implicitly.  Therefore the following table should not be styled
by the max-width style rule setting for this paragraph.

<table border="1">
<tr>
<td>Some very boring, long-winded text.  It should be enough to stretch the
table wider than the max-width setting.</td>
<td>More long and boring text, enough to make the table wider than the max-width
 setting.</td>
</tr>
</table>

<p style="max-width:10em;">This paragraph is closed, so let's see if the
following table has the same problem as the above table.</p>

<table border="1">
<tr>
<td>Some very boring, long-winded text.  It should be enough to stretch the
table wider than the max-width setting.</td>
<td>More long and boring text, enough to make the table wider than the max-width
 setting.</td>
</tr>
</table>

<p>Ah, the above table does not inherit the style rule of the preceding paragraph.

<p>Note that this problem also occurs if the max-width setting is made in a user
style sheet.

</body>
</html>
Summary: Unclosed <p> not being implictly closed by following <table> wrt to user style sheet → Unclosed <p> not being implictly closed by following <table> wrt to max-width style
Attached file testcase
Unfortunately, almost every single site out there relies on browsers NOT closing
out <p> tags when <table> is hit, so the parser allows <table> inside <p>. 
Layout just lays out the DOM, and there is no layout bug here; as a parser bug
this is a wontfix, unfortunately.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → WONTFIX
We really shouldn't do this in strict mode, though.
   http://www.hixie.ch/tests/adhoc/html/parsing/013.html
Reopening.
Severity: normal → minor
Status: RESOLVED → UNCONFIRMED
Component: Layout: Block & Inline → Parser
Resolution: WONTFIX → ---
Summary: Unclosed <p> not being implictly closed by following <table> wrt to max-width style → <table> should close <p> in strict mode
.
Assignee: block-and-inline → harishd
Status: UNCONFIRMED → NEW
Ever confirmed: true
QA Contact: ian → dsirnapalli
Well, as I know, <p> should be closed only for block-level elements. But table
could be both block level and inline object
(http://www.w3.org/TR/REC-CSS2/tables.html#q2), or I misread manual again? I see
same stuff at bug 17054.
Does anyone search for duplicates?

*** This bug has been marked as a duplicate of 91927 ***
Status: NEW → RESOLVED
Closed: 21 years ago21 years ago
Resolution: --- → DUPLICATE
Verified.

Ruslan, the CSS spec has absolutely nothing to do with HTML parsing; the HTML
concepts of block and inline have nothing to do with CSS display types.
v
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: