HTML's table model vs @hidden & display:none

http://dev.w3.org/html5/spec/tabular-data.html#table-model

I cannot see that it is said that CSS (e.g. td{display:none}) affects 
the table model. And I suspect that the @hidden attribute also has the 
same effect. But there is nothing said about that either. I suggest 
changing the spec to say that CSS td{display:none} or - better - <td 
hidden > (or some equivalent attribute aimed at this particular 
purpose) takes part in the table model. 

Problem: The HTML table model has a problem with its logics. Good news: 
the logical problem seems to be solvable via either CSS and/or the 
@hidden attribute.

Example of the problems: This CSS selector,

	td:first-child+td {background:red}

will in the following table,

 <table>
  <tr id="row1"><td            >1<td>2<td>3</tr>
  <tr id="row2"><td colspan="2">1<td     >3</tr></table>

select different columns in each row. (Second column in #row1, and 
third column in #row2.) This may or may not be what the author wants. 
But at any rate, it often comes as a surprise. ;-)

The HTML table model is also difficult to work with in the source code: 
If you span a cell over more rows or columns, you are expected to 
remove the cells that it spans over from the affected rows and columns. 
Fine. But I would have preferred to be able to put some "stakes in the 
ground", so that I could count - in the source code - the cells that 
the span jumped over. I have seen many solve this problem by adding 
<!--<td>--> in the source code. But this is both tedious and slow to 
work with.

However, a while back, I discovered (what perhaps is yesterdays news to 
many of you ...), that the confusion (including the source code 
confusion) can be solved via CSS itself:

<table><tr 
    id="row1"><td           >1<td                    >2<td>3</tr>
<tr id="row2"><td colspan="2">1<td style=DISPLAY:NONE >2<td>3</tr>
</table>

And in HTML5, instead of CSS display:one, I can use the @hidden 
attribute to the same effect (I suppose). Though logically, there 
should have been a special "disabled-cell" attribute, for such cells, I 
guess. (Or may be the @hidden attribute should have had a better name, 
such as "disabled"?!)

But anyway: In the variant above, the same CSS selector will select the 
second cell in each row. (Which means that there will be no visible 
cell with red background in the #row2.)

However, this variant creates a warning in validator.nu because the 
number or cells in a row doesn't add up (there is one too many, it 
says, in the last row). HTML4 doesn't provide any warning.

Summary:

	a) I think the HTML5 spec should document this much simpler variant of 
the table model.
	b) How does this work together with the scope attribute and the header 
cell association algorithm in general?
	c) In the DOM, the none-used cells are of course present in the DOM. 
But Validator.nu should not count an element with @hidden or @disabled. 

Test case: 
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/419
-- 
leif halvard silli

Received on Tuesday, 23 March 2010 04:24:04 UTC