According to XHTML1 Strict,

is not allowed (check http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd line 862)

Attached patch modifies theme_table to check if there are columns to render before adding a row to the output.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

traxer’s picture

According to XHTML1 Strict, is not allowed

According to XHTML1 Strict, <tr></tr> is not allowed; a table row must contain at least one td- or th-tag.

traxer’s picture

I just noticed that theme_table() might also create other kinds of empty elements. However, I did not see any pages that are affected by that.

Empty table rows can be found at admin/build/themes in Drupal 5.1

pwolanin’s picture

Title: theme_table might create <tr></tr> » theme_table creates invalid (empty) <tr></tr> rows
Status: Needs review » Reviewed & tested by the community
FileSize
1.46 KB

patch code looks simple and reasonable.
However, there are two minor problems:

patch should be made from the drupal root directory
the if statement should be sooner so that the odd/even class doesn't flip if the row is empty

new patch addresses these problems and should be RTBC.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)