W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 1999

FixEmptyRow() patch: don't generate TD in implicit TR

From: <html-tidy@war-of-the-worlds.org>
Date: Tue, 12 Oct 1999 09:26:27 -0500
Message-Id: <v04205500b428f2f50944@[216.229.13.10]>
To: html-tidy@w3.org
I found a problem with FixEmptyRow().  In some cases where there was 
content inside TABLE that was not within neither a TD nor TR, it 
would move the content to before the TABLE (successfully if TABLE was 
not the first child of its container -- addressed in earlier, big 
patch, as a fix to MoveBeforeTable()), but would still put a <TR><TD> 
in its place.  The fix was to test if the TR was actually in the 
document or was generated by Tidy.  This is performed by testing the 
->implicit field of the TR's Node.

The fixed FixEmptyRow() function is below.

/*
  if a table row is empty then insert an empty cell
  this practice is consistent with browser behavior
  and avoids potential problems with row spanning cells
*/
void FixEmptyRow(Lexer *lexer, Node *row)
{
     Node *cell;

     if (!row->implicit) {
         if (row->content == null)
         {
             cell = InferredTag(lexer, "td");
             InsertNode(row, cell);
             ReportWarning(lexer, row, cell, MISSING_STARTTAG);
         }
     }
     else
         /*
          If row is implicit, then it was not in original, so there's no
          spanning issue requiring its preservation, so don't imply a TD,
          instead remove it if it is empty.
         */
         TrimEmptyElement(lexer, row);
}
-- 
          ,=<#)-=#  <http://www.war-of-the-worlds.org/>
     ,_--//--_,
  _-~_-(####)-_~-_  "Did you see that Parkins boy's body in the tunnels?" "Just
(#>_--'~--~`--_<#)  the photos.  Worst thing I've ever seen; kid had no face."
Received on Tuesday, 12 October 1999 10:29:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:42 GMT