W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2012

Re: [whatwg] Proposals for better support of Tables

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 6 Nov 2012 19:21:53 +0000 (UTC)
To: Alexandre Morgaut <Alexandre.Morgaut@4d.com>
Message-ID: <Pine.LNX.4.64.1211061914010.2478@ps20323.dreamhostps.com>
Cc: "whatwg@whatwg.org" <whatwg@whatwg.org>
On Mon, 7 Feb 2011, Alexandre Morgaut wrote:
> 
> The HTML Table API provides powerful attributes like:
> - "scope"
> - "headers"
> - "colspan"
> - "rowspan"
> 
> All of them give informations about relationships between the table 
> cells, rows, and columns
> 
> It would be very helpful if:
>  - each "th" element could have a "cells" property which would be the 
> HTML Collection of each "td" they are heading
>  - each "td" element could have a "headerCells" property which would be 
> the HTML Collection of each of their related "th"
>  - each cell element could have "rows" and "columns" properties which 
> would be the HTML collection of each rows and columns covered by their 
> rowspan and colspan attributes

I was looking at this, and I think such an API is very attractive from a 
theoretical perspective, but I don't really understand what problem it 
would solve. Can you elaborate on what use cases you have for this? What 
would the page be doing with this API?


> Actually we can use getElementByClassName(), so we often see
> 
> <tr><th id="th1" colspan="2">MySection</th></tr>
> <tr><th id="th2" class="child-of-th1" scope="row">MyName</th><td>MyData</td></tr>
> <tr><th id="th3" class="child-of-th2" scope="row">+ MySubName</th><td>MySubData</td></tr>
>   
> instead of
> 
> <tr><th id="th1" colspan="2">MySection</th></tr>
> <tr><th id="th2" headers="th1" scope="row">MyName</th><td>MyData</td></tr>
> <tr><th id="th3" headers="th1 th2" scope="row">+ MySubName</th><td>MySubData</td></tr>

Do you have examples of pages that are like this that would benefit from 
the API you describe?


> About "headers" I wonder if this would be acceptable:
> 
> <tr><th id="th1" colspan="2">MySection</th></tr>
> <tr><th id="th2" headers="th1" scope="row">MyName</th><td>MyData</td></tr>
> <tr><th id="th3" headers="th2" scope="row">+ MySubName</th><td>MySubData</td></tr>
> 
> as for the third row, the th1 header is implicit from the th2 declared header

Yup, that is allowed and is defined to work as you'd expect.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 6 November 2012 19:22:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT