W3C home > Mailing lists > Public > www-style@w3.org > June 2008

Re: [CSS21] Should CSS table fixup apply to HTML tables?

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 17 Jun 2008 00:49:35 -0500
Message-ID: <4857506F.7000007@mit.edu>
To: Saloni Mira Rai <salonir@microsoft.com>
CC: "www-style@w3.org" <www-style@w3.org>

Saloni Mira Rai wrote:
 > According to section 17.2
 > (http://www.w3.org/TR/CSS21/tables.html#table-display) the model applies to
 > HTML elements as well as elements with the appropriate display:table*
 > property.

I'm not sure it claims to apply to "HTML elements" unless they have the 
appropriate display:table*.  It just claims that any HTML implementation that 
supports CSS would presumably have UA rules that set those display values for 
the relevant HTML elements, and that thus it's enough to define the behavior for 
the display values.

It's easy enough to test this by setting "display: block" or some such on 
table-internal elements and seeing what happens.

> Tablefixup_TR.htm has the following markup:
> 
> <table>
> <td>X1</td>
> <tr>XRow1_ABCD</tr>
> <td>X2</td>
> <tr>XRow2_XYZ</tr>
> </table>

The real question is what DOM is produced from this markup.  Note that CSS is 
applied to the DOM, not to the source.  So the table anonymous box stuff happens 
after whatever HTML parser fixups happen in this situation.

> IE7 and Opera will put the <TR> elements at the top of the table, each 
> as a separate row element.
> 
> Firefox 3 and Safari appear to take the content of the <TR> elements out 
> of the table, and put it on top.

The Firefox behavior here is a parser-level invalid-markup fixup.  The text is 
actually placed before the HTMLTableElement in the DOM.

> IE8 generates anonymous table objects according to CSS rules. The 
> content will be displayed in the order specified in the markup.

That's perfectly allowed per the HTML 4 "do whatever you want to with invalid 
markup" text, but I should note that the HTML5 drafts currently specify some 
parser fixups here.

If you want to see purely the effects of the CSS spec prose without reference to 
parser fixups, you probably want to use XHTML, not HTML, since XML parsers do 
not perform such fixups.

> Similarly, consider the attached file tablefixup_TFOOT.htm, which has 
> the following markup:

Again, this is a parse-time fixup in Firefox.

> So my questions are:
> 
> 1.       Do developers on this list rely on this behavior? IE8 has made 
> significant changes and we are concerned about compatibility with legacy 
> HTML tables.
> 
> 2.       Have other UAs decided to keep this around as legacy behavior, 
> or is this something that might be fixed?

I think the best way forward here is for UAs to converge on a single parsing 
behavior, and for HTML5 to specify said behavior.  This will give not only 
compatible rendering but also compatible DOMs.

Then CSS can just be applied to the resulting DOM.

> 3.       CSS3 will not be more “stringent” than CSS2.1 in requiring HTML 
> fixup to change.

I don't think either one requires any "HTML fixup"...

-Boris
Received on Tuesday, 17 June 2008 05:57:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:07 GMT