I have found an issue in which HTML Tidy is not only
incorrectly terminating a table but also results in an
incorrectly ordered document tree/output.
The attached sample contains a centered table with an
another <CENTER> tag appearing in the table between
table cell (illegal). This results in the table being
incorrectly terminated with the remaining cells of the
row and all subsequent rows inserted into a second table.
Furthermore, the insertion of this into the document
tree appears to be incorrectly handled resulting in the
text after the table being added before the table, then
the second table appears, and then the first table (ie
Visual observation of the input HTML with MSIE and
Firefox appear to show two different behaviors.
MSIE moves any content or non-table elements within a
table but outside of cells or captions to before the
table (as if it originally appeared before). As such,
the CENTER affects the text following the table.
FF seems to be more closer to the specifications and
appears to completely disregard any content non-table
elements that fall outside of cells or captions.
Either end result is acceptable but the current
termination and mis-ordering clearly is not.
NOTE: This may somehow be related to Issue #1316258
which I just reported as well.