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

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 UTC