RE: bug in handling </p> inside <table>

Tung -- your HTML is at fault, according to the HTML specification: 

11.2.1 The TABLE element

<!ELEMENT TABLE - -
     (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>

Those are the only allowed child elements of TABLE. Note that most TBODY was
introduced after the original implementations of TABLE, so most browsers
imply an TBODY if they see TABLE - TR without containing TBODY. 

cheers,
~stuart 


-----Original Message-----
From: Tung Mansfield [mailto:mansfield@orbitcommerce.com]
Sent: Monday, July 24, 2000 9:45 AM
To: 'html-tidy@w3.org'
Subject: bug in handling </p> inside <table>


I have the following html:

<html>
<body>
<table>
<tr><td></td></tr>
<p>
</p>
<tr><td></td></tr>
</table>
</body>
</html>

When this html is parsed by the latest JTidy (released in July 2000), I get
the following warnings:

Tidy (vers 8th July 2000) Parsing "InputStream"
line 2 column 1 - Warning: inserting missing 'title' element
line 3 column 1 - Warning: <table> lacks "summary" attribute
line 5 column 1 - Warning: <p> isn't allowed in <table> elements
line 6 column 1 - Warning: </p> isn't allowed in <table> elements
line 6 column 1 - Warning: replacing element</p> by <br>
line 6 column 1 - Warning: inserting implicit <br>
line 7 column 2 - Warning: <tr> isn't allowed in <body> elements
line 7 column 2 - Warning: inserting implicit <table>
"InputStream" appears to be HTML 3.2
8 warnings/errors were found!

Here is the resulting html:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title></title>
</head>
<body>
<p></p>

<table>
<tr>
<td></td>
</tr>
</table>

<br>
<br>
 

<table>
<tr>
<td></td>
</tr>
</table>
</body>
</html>

The <p> and </p> tags on lines 5 and 6 (of the original html) are replaced
with two <br> tags. Also, a <table> tag was inserted. The first change is
OK, but the second one causes problems. The <table> tag should not be
inserted. Please fix this.

Received on Monday, 24 July 2000 13:45:19 UTC