[html5] r2547 - [act] (1) * Header cells can now themselves have headers. * Reversed the way the [...]
whatwg at whatwg.org
whatwg at whatwg.org
Sat Dec 20 01:21:43 PST 2008
Author: ianh
Date: 2008-12-20 01:21:43 -0800 (Sat, 20 Dec 2008)
New Revision: 2547
Modified:
index
source
Log:
[act] (1) * Header cells can now themselves have headers.
* Reversed the way the header association algorithm is presented, such
that it starts from a cell and reports the headers rather than
generating the list of headers for each cell on a header-by-header
basis.
* Made it so that if headers="" points to a <td> element, the
association is now set up, despite being non-conforming.
* Header cells that are automatically associating now no longer stop
associating when they hit equivalent cells until they have also hit
a data cell.
* The "col" and "row" scope values now act like the implied auto value
except that they force the direction.
* Empty header cells no longer get automatically associated.
* Removed the wide header cell heuristic.
* Made headers="" use the same ID discovery mechanism as
getElementById() (namely, first match), to avoid implementations
having to support multiple such mechanisms.
* Made the spec define if a header is a column header or a row header
in the case where scope="" is omitted.
* Made scope=rowgroup and scope=colgroup non-conforming when not in an
appropriate group.
Modified: index
===================================================================
--- index 2008-12-19 06:38:56 UTC (rev 2546)
+++ index 2008-12-20 09:21:43 UTC (rev 2547)
@@ -21,7 +21,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML 5</h1>
- <h2 class="no-num no-toc" id=draft-recommendation-—-date:-01-jan-1901>Draft Recommendation — 19 December 2008</h2>
+ <h2 class="no-num no-toc" id=draft-recommendation-—-date:-01-jan-1901>Draft Recommendation — 20 December 2008</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<dl><dt>Multiple-page version:</dt>
@@ -22195,38 +22195,18 @@
<dt>Element-specific attributes:</dt>
<dd><code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code></dd>
<dd><code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code></dd>
- <dd><code title=attr-td-headers><a href=#attr-td-headers>headers</a></code></dd>
- <!-- XXXv2 char, to specify the decimal character used in numeric cells -->
+ <dd><code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code></dd>
+ <!-- v2 char, to specify the decimal character used in numeric cells -->
<dt>DOM interface:</dt>
<dd>
- <pre class=idl>interface <dfn id=htmltabledatacellelement>HTMLTableDataCellElement</dfn> : <a href=#htmltablecellelement>HTMLTableCellElement</a> {
- attribute DOMString <a href=#dom-td-headers title=dom-td-headers>headers</a>;
-};</pre>
+ <pre class=idl>interface <dfn id=htmltabledatacellelement>HTMLTableDataCellElement</dfn> : <a href=#htmltablecellelement>HTMLTableCellElement</a> {};</pre>
</dd>
</dl><p>The <code><a href=#the-td-element>td</a></code> element represents a data <a href=#concept-cell title=concept-cell>cell</a> in a table.</p>
- <p>The <code><a href=#the-td-element>td</a></code> element may have a <dfn id=attr-td-headers title=attr-td-headers><code>headers</code></dfn> content attribute
- specified. The <code title=attr-td-headers><a href=#attr-td-headers>headers</a></code>
- attribute, if specified, must contain a string consisting of an
- <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a>, each of
- which must have the value of an ID of a <code><a href=#the-th-element>th</a></code> element
- taking part in the same <a href=#concept-table title=concept-table>table</a> as
- the <code><a href=#the-td-element>td</a></code> element (as defined by the <a href=#table-model>table
- model</a>).</p>
-
- <p>The exact effect of the attribute is described in detail in the
- <a href=#algorithm-for-assigning-header-cells-to-data-cells>algorithm for assigning header cells to data cells</a>,
- which user agents must apply to determine the relationships between
- data cells and header cells.</p>
-
- <p>The <code><a href=#the-td-element>td</a></code> element and its <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> and <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> attributes take part in the
+ <p class=note>The <code><a href=#the-td-element>td</a></code> element and its <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>, <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, and <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attributes take part in the
<a href=#table-model>table model</a>.</p>
- <p>The <dfn id=dom-td-headers title=dom-td-headers><code>headers</code></dfn> DOM
- attribute must <a href=#reflect>reflect</a> the content attribute of the
- same name.</p>
-
<h4 id=the-th-element><span class=secno>4.9.11 </span>The <dfn><code>th</code></dfn> element</h4>
<dl class=element><dt>Categories</dt>
@@ -22238,6 +22218,7 @@
<dt>Element-specific attributes:</dt>
<dd><code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code></dd>
<dd><code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code></dd>
+ <dd><code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code></dd>
<dd><code title=attr-th-scope><a href=#attr-th-scope>scope</a></code></dd>
<dt>DOM interface:</dt>
<dd>
@@ -22255,28 +22236,34 @@
<dl><dt>The <dfn id=attr-th-scope-row title=attr-th-scope-row><code>row</code></dfn>
keyword, which maps to the <i>row</i> state</dt>
- <dd>The <i>row</i> state means the header cell applies to all the
- remaining cells in the row.</dd>
+ <dd>The <i>row</i> state means the header cell applies to some of
+ the subsequent cells in the same row(s).</dd>
<dt>The <dfn id=attr-th-scope-col title=attr-th-scope-col><code>col</code></dfn>
keyword, which maps to the <i>column</i> state</dt>
- <dd>The <i>column</i> state means the header cell applies to all
- the remaining cells in the column.</dd>
+ <dd>The <i>column</i> state means the header cell applies to some
+ of the subsequent cells in the same column(s).</dd>
<dt>The <dfn id=attr-th-scope-rowgroup title=attr-th-scope-rowgroup><code>rowgroup</code></dfn> keyword,
which maps to the <i>row group</i> state</dt>
- <dd>The <i>row group</i> state means the header cell applies to
- all the remaining cells in the row group.</dd>
+ <dd>The <i>row group</i> state means the header cell applies to all
+ the remaining cells in the row group. A <code><a href=#the-th-element>th</a></code> element's
+ <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute must not be in
+ the <a href=#attr-th-scope-rowgroup title=attr-th-scope-rowgroup>row group</a> state if
+ the element is not anchored in a <a href=#concept-row-group title=concept-row-group>row group</a>.</dd>
<dt>The <dfn id=attr-th-scope-colgroup title=attr-th-scope-colgroup><code>colgroup</code></dfn> keyword,
which maps to the <i>column group</i> state</dt>
- <dd>The <i>column group</i> state means the header cell applies
- to all the remaining cells in the column group.</dd>
+ <dd>The <i>column group</i> state means the header cell applies to
+ all the remaining cells in the column group. A <code><a href=#the-th-element>th</a></code>
+ element's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute must
+ not be in the <a href=#attr-th-scope-colgroup title=attr-th-scope-colgroup>column
+ group</a> state if the element is not anchored in a <a href=#concept-column-group title=concept-column-group>column group</a>.</dd>
- <dt>The <i>auto</i> state</dt>
+ <dt>The <dfn id=attr-th-scope-auto title=attr-th-scope-auto>auto</dfn> state</dt>
<dd>The <i>auto</i> state makes the header cell apply to a set of
cells selected based on context.</dd>
@@ -22284,12 +22271,7 @@
</dl><p>The <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute's
<i>missing value default</i> is the <i>auto</i> state.</p>
- <p>The exact effect of these values is described in detail in the
- <a href=#algorithm-for-assigning-header-cells-to-data-cells>algorithm for assigning header cells to data cells</a>,
- which user agents must apply to determine the relationships between
- data cells and header cells.</p>
-
- <p>The <code><a href=#the-th-element>th</a></code> element and its <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> and <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> attributes take part in the
+ <p class=note>The <code><a href=#the-th-element>th</a></code> element and its <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>, <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code>, and <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attributes take part in the
<a href=#table-model>table model</a>.</p>
<p>The <dfn id=dom-th-scope title=dom-th-scope><code>scope</code></dfn> DOM
@@ -22308,6 +22290,18 @@
attribute specified, whose value must be a <a href=#valid-non-negative-integer>valid non-negative
integer</a>.</p>
+ <p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> element may have a <dfn id=attr-tdth-headers title=attr-tdth-headers><code>headers</code></dfn> content
+ attribute specified. The <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute, if specified,
+ must contain a string consisting of an <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of unique
+ space-separated tokens</a>, each of which must have the value of
+ an ID of a <code><a href=#the-th-element>th</a></code> element taking part in the same <a href=#concept-table title=concept-table>table</a> as the <code><a href=#the-td-element>td</a></code> or
+ <code><a href=#the-th-element>th</a></code> element (as defined by the <a href=#table-model>table
+ model</a>).</p>
+
+ <p class=note>The <code title=attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>,
+ <code title=attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, and <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attributes take part in the
+ <a href=#table-model>table model</a>.</p>
+
<p>The <code><a href=#the-td-element>td</a></code> and <code><a href=#the-th-element>th</a></code> elements implement
interfaces that inherit from the <code><a href=#htmltablecellelement>HTMLTableCellElement</a></code>
interface:</p>
@@ -22315,6 +22309,7 @@
<pre class=idl>interface <dfn id=htmltablecellelement>HTMLTableCellElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute long <a href=#dom-tdth-colspan title=dom-tdth-colSpan>colSpan</a>;
attribute long <a href=#dom-tdth-rowspan title=dom-tdth-rowSpan>rowSpan</a>;
+ attribute DOMString <a href=#dom-tdth-headers title=dom-tdth-headers>headers</a>;
readonly attribute long <a href=#dom-tdth-cellindex title=dom-tdth-cellIndex>cellIndex</a>;
};</pre>
@@ -22329,6 +22324,10 @@
attribute as a non-negative integer</a> returns an error, is also
1.</p>
+ <p>The <dfn id=dom-tdth-headers title=dom-tdth-headers><code>headers</code></dfn> DOM
+ attribute must <a href=#reflect>reflect</a> the content attribute of the
+ same name.</p>
+
<p>The <dfn id=dom-tdth-cellindex title=dom-tdth-cellIndex><code>cellIndex</code></dfn>
DOM attribute must, if the element has a parent <code><a href=#the-tr-element>tr</a></code>
element, return the index of the cell's element in the parent
@@ -22356,10 +22355,13 @@
the cell covers all the slots with coordinates (<var title="">x</var>, <var title="">y</var>) where <span><var title="">cell<sub title="">x</sub></var> ≤ <var title="">x</var> < <var title="">cell<sub title="">x</sub></var>+<var title="">width</var></span> and
<span><var title="">cell<sub title="">y</sub></var> ≤ <var title="">y</var> < <var title="">cell<sub title="">y</sub></var>+<var title="">height</var></span>. Cells can
either be <em>data cells</em> or <em>header cells</em>. Data cells
- correspond to <code><a href=#the-td-element>td</a></code> elements, and have zero or more
- associated header cells. Header cells correspond to <code><a href=#the-th-element>th</a></code>
- elements.</p>
+ correspond to <code><a href=#the-td-element>td</a></code> elements, and header cells correspond
+ to <code><a href=#the-th-element>th</a></code> elements. Cells of both types can have zero or
+ more associated header cells.</p>
+ <p>It is possible, in certain error cases, for two cells to occupy
+ the same slot.</p>
+
<p>A <dfn id=concept-row title=concept-row>row</dfn> is a complete set of slots
from <span><var title="">x</var>=0</span> to <span><var title="">x</var>=<var title="">x<sub title="">width</sub></var>-1</span>, for a particular value of <var title="">y</var>. Rows correspond to <code><a href=#the-tr-element>tr</a></code> elements.</p>
@@ -22925,11 +22927,11 @@
<p>If the <var title="">current cell</var> element is a
<code><a href=#the-th-element>th</a></code> element, let this new cell <var title="">c</var>
- be a header cell; otherwise, let it be a data cell. To establish
- what header cells apply to a data cell, use the <a href=#algorithm-for-assigning-header-cells-to-data-cells>algorithm
- for assigning header cells to data cells</a> described in the
- next section.</p>
+ be a header cell; otherwise, let it be a data cell.</p>
+ <p>To establish which header cells apply to the <var title="">current cell</var> element, use the <a href=#algorithm-for-assigning-header-cells>algorithm for
+ assigning header cells</a> described in the next section.</p>
+
<p>If any of the slots involved already had a <a href=#concept-cell title=concept-cell>cell</a> covering them, then this is a
<a href=#table-model-error>table model error</a>. Those slots now have two cells
overlapping.</p>
@@ -22986,290 +22988,343 @@
<h5 id=header-and-data-cell-semantics><span class=secno>4.9.13.2 </span>Forming relationships between data cells and header cells</h5>
- <p>Each data cell can be assigned zero or more header cells. The
- <dfn id=algorithm-for-assigning-header-cells-to-data-cells>algorithm for assigning header cells to data cells</dfn> is as
- follows.</p>
+ <p>Each cell can be assigned zero or more header cells. The
+ <dfn id=algorithm-for-assigning-header-cells>algorithm for assigning header cells</dfn> to a cell <var title="">principal cell</var> is as follows.</p>
- <ol><li>
+ <ol><!-- INITIALIZATION --><li>
- <p>For each header cell in the table, in <a href=#tree-order>tree order</a>,
- run these substeps:</p>
+ <p>Let <var title="">header list</var> be an empty list of
+ cells.</p>
- <ol><li>
+ </li>
- <p>Let (<var title="">header<sub title="">x</sub></var>, <var title="">header<sub title="">y</sub></var>) be the coordinate of
- the slot to which the header cell is anchored.</p>
+ <li>
- </li>
+ <p>Let (<var title="">principal<sub title="">x</sub></var>, <var title="">principal<sub title="">y</sub></var>) be the coordinate
+ of the slot to which the <var title="">principal cell</var> is
+ anchored.</p>
- <li>
+ </li>
- <p>Let <var title="">header<sub title="">width</sub></var> be
- the width of the header cell.</p>
+ <li>
- </li>
+ <dl class=switch><dt>If the <var title="">principal cell</var> has a <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute specified</dt>
- <li>
+ <dd>
- <p>Let <var title="">header<sub title="">height</sub></var> be
- the height of the header cell.</p>
+ <!-- HEADERS="" -->
- </li>
+ <ol><li>
- <li>
+ <p>Take the value of the <var title="">principal cell</var>'s
+ <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute and
+ <a href=#split-a-string-on-spaces title="split a string on spaces">split it on
+ spaces</a>, letting <var title="">id list</var> be the list
+ of tokens obtained.</p>
- <p>Let <var title="">data cells</var> be a list of data cells,
- initially empty.</p>
+ </li>
- </li>
+ <li>
- <li>
+ <!-- support headers="" to <td> for legacy compat -->
+ <!-- note that it's not conforming though -->
+ <p>For each token in the <var title="">id list</var>, if the
+ first element in the <code>Document</code> with an ID equal to
+ the token is a cell in the same <a href=#concept-table title=concept-table>table</a>, and that cell is not the
+ <var title="">principal cell</var>, then add that cell to <var title="">header list</var>.</p>
- <p>Examine the <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code>
- attribute of the <code><a href=#the-th-element>th</a></code> element corresponding to the
- header cell, and, based on its state, apply the appropriate
- substep:</p>
+ </li>
- <dl class=switch><dt>If it is in the <i title=attr-th-scope-row><a href=#attr-th-scope-row>row</a></i> state</dt>
+ </ol></dd>
- <dd>
- <p>Add all the data cells that cover slots with coordinates
- (<var title="">slot<sub title="">x</sub></var>, <var title="">slot<sub title="">y</sub></var>), where <span><var title="">header<sub title="">x</sub></var>+<var title="">header<sub title="">width</sub></var> ≤ <var title="">slot<sub title="">x</sub></var> < <var title="">x<sub title="">width</sub></var></span> and
- <span><var title="">header<sub title="">y</sub></var> ≤ <var title="">slot<sub title="">y</sub></var> < <var title="">header<sub title="">y</sub></var>+<var title="">header<sub title="">height</sub></var></span>, to the <var title="">data
- cells</var> list.</p>
+ <dt>If <var title="">principal cell</var> does not have a <code title=attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute specified</dt>
- </dd>
+ <dd>
- <dt>If it is in the <i title=attr-th-scope-col><a href=#attr-th-scope-col>column</a></i> state</dt>
+ <ol><li>
- <dd>
+ <p>Let <var title="">principal<sub title="">width</sub></var>
+ be the width of the <var title="">principal cell</var>.</p>
- <p>Add all the data cells that cover slots with coordinates
- (<var title="">slot<sub title="">x</sub></var>, <var title="">slot<sub title="">y</sub></var>), where <span><var title="">header<sub title="">x</sub></var> ≤ <var title="">slot<sub title="">x</sub></var> < <var title="">header<sub title="">x</sub></var>+<var title="">header<sub title="">width</sub></var></span> and
- <span><var title="">header<sub title="">y</sub></var>+<var title="">header<sub title="">height</sub></var> ≤ <var title="">slot<sub title="">y</sub></var> < <var title="">y<sub title="">height</sub></var></span>, to the <var title="">data cells</var> list.</p>
+ </li>
- </dd>
+ <li>
- <dt>If it is in the <i title=attr-th-scope-rowgroup><a href=#attr-th-scope-rowgroup>row group</a></i> state</dt>
+ <p>Let <var title="">principal<sub title="">height</sub></var>
+ be the height of the <var title="">principal cell</var>.</p>
- <dd>
+ </li>
- <p>If the header cell is not in a <a href=#concept-row-group title=concept-row-group>row group</a>, then do
- nothing.</p>
- <p>Otherwise, let (0, <var title="">group<sub title="">y</sub></var>) be the slot at which the row group is
- anchored, let <var title="">height</var> be the number of rows
- in the row group, and add all the data cells that cover slots
- with coordinates (<var title="">slot<sub title="">x</sub></var>, <var title="">slot<sub title="">y</sub></var>), where <span><var title="">header<sub title="">x</sub></var> ≤ <var title="">slot<sub title="">x</sub></var> < <var title="">x<sub title="">width</sub></var></span> and <span><var title="">header<sub title="">y</sub></var> ≤ <var title="">slot<sub title="">y</sub></var> < <var title="">group<sub title="">y</sub></var>+<var title="">height</var></span>, to the <var title="">data
- cells</var> list.</p>
+ <!-- HORIZONTAL -->
- </dd>
+ <li>
- <dt>If it is in the <i title=attr-th-scope-colgroup><a href=#attr-th-scope-colgroup>column group</a></i> state</dt>
+ <p>For each value of <var title="">y</var> from <var title="">principal<sub title="">y</sub></var> to <span><var title="">principal<sub title="">y</sub></var>+<var title="">principal<sub title="">height</sub></var>-1</span>,
+ run the <a href=#internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning
+ header cells</a>, with the <var title="">principal
+ cell</var>, the <var title="">header list</var>, the initial
+ coordinate (<var title="">principal<sub title="">x</sub></var>,<var title="">y</var>), and the
+ increments <span>Δ<var title="">x</var>=−1</span>
+ and <span>Δ<var title="">y</var>=0</span>.</p>
- <dd>
+ </li>
- <p>If the header cell is not anchored in a <a href=#concept-column-group title=concept-column-group>column group</a>, then do
- nothing.</p>
- <p>Otherwise, let (<var title="">group<sub title="">x</sub></var>, 0) be the slot at which that column
- group is anchored, let <var title="">width</var> be the number
- of columns in the column group, and add all the data cells
- that cover slots with coordinates (<var title="">slot<sub title="">x</sub></var>, <var title="">slot<sub title="">y</sub></var>), where <span><var title="">header<sub title="">x</sub></var> ≤ <var title="">slot<sub title="">x</sub></var> < <var title="">group<sub title="">x</sub></var>+<var title="">width</var></span> and
- <span><var title="">header<sub title="">y</sub></var> ≤ <var title="">slot<sub title="">y</sub></var> < <var title="">y<sub title="">height</sub></var></span>, to the <var title="">data
- cells</var> list.</p>
+ <!-- VERTICAL -->
- </dd>
+ <li>
- <dt>Otherwise, it is in the <i title="">auto</i> state</dt>
+ <p>For each value of <var title="">x</var> from <var title="">principal<sub title="">x</sub></var> to <span><var title="">principal<sub title="">x</sub></var>+<var title="">principal<sub title="">width</sub></var>-1</span>,
+ run the <a href=#internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning
+ header cells</a>, with the <var title="">principal
+ cell</var>, the <var title="">header list</var>, the initial
+ coordinate (<var title="">x</var>,<var title="">principal<sub title="">y</sub></var>), and the increments <span>Δ<var title="">x</var>=0</span> and <span>Δ<var title="">y</var>=−1</span>.</p>
- <dd>
+ </li>
- <p>Run these steps:</p>
- <ol><li>
+ <!-- ROW GROUP HEADERS -->
- <p>If the header cell is <a href=#equivalent-to-a-wide-cell>equivalent to a wide
- cell</a>, let <var title="">header<sub title="">width</sub></var> equal <span><var title="">x<sub title="">width</sub></var>-<var title="">header<sub title="">x</sub></var></span>.</p>
+ <li>
- </li>
+ <p>If the <var title="">principal cell</var> is anchored in a
+ <a href=#concept-row-group title=concept-row-group>row group</a>, then add all
+ header cells that are <a href=#row-group-header title="row group header">row group
+ headers</a> and are anchored in the same row group with an
+ <var title="">x</var>-coordinate less than or equal to
+ <span><var title="">principal<sub title="">x</sub></var>+<var title="">principal<sub title="">width</sub></var>-1</span> and
+ a <var title="">y</var>-coordinate less than or equal to
+ <span><var title="">principal<sub title="">y</sub></var>+<var title="">principal<sub title="">height</sub></var>-1</span> to
+ <var title="">header list</var>.</p>
- <li>
+ </li>
- <p>Let <var title="">x</var> equal <span><var title="">header<sub title="">x</sub></var>+<var title="">header<sub title="">width</sub></var></span>.</p>
- </li>
+ <!-- COLUMN GROUP HEADERS -->
- <li>
+ <li>
- <p>Let <var title="">y</var> equal <span><var title="">header<sub title="">y</sub></var>+<var title="">header<sub title="">height</sub></var></span>.</p>
+ <p>If the <var title="">principal cell</var> is anchored in a
+ <a href=#concept-column-group title=concept-column-group>column group</a>, then
+ add all header cells that are <a href=#column-group-header title="column group
+ header">column group headers</a> and are anchored in the
+ same column group with an <var title="">x</var>-coordinate
+ less than or equal to <span><var title="">principal<sub title="">x</sub></var>+<var title="">principal<sub title="">width</sub></var>-1</span> and a <var title="">y</var>-coordinate less than or equal to <span><var title="">principal<sub title="">y</sub></var>+<var title="">principal<sub title="">height</sub></var>-1</span> to
+ <var title="">header list</var>.</p>
- </li>
+ </li>
- <li>
+ </ol></dd>
- <p><i>Horizontal</i>: If <var title="">x</var> is equal to
- <var title="">x<sub title="">width</sub></var>, then jump
- down to the step below labeled <i>vertical</i>.</p>
+ </dl></li>
- </li>
- <li>
+ <!-- CLEANUP -->
- <p>If there is a header cell anchored at (<var title="">x</var>, <var title="">header<sub title="">y</sub></var>) with height <var title="">header<sub title="">height</sub></var>, then jump down to the step
- below labeled <i>vertical</i>.</p>
+ <li>
- </li>
+ <p>Remove all the <a href=#empty-cell title="empty cell">empty cells</a> from
+ the <var title="">header list</var>.</p>
- <li>
+ </li>
- <p>Add all the data cells that cover slots with coordinates
- (<var title="">slot<sub title="">x</sub></var>, <var title="">slot<sub title="">y</sub></var>), where <span><var title="">slot<sub title="">x</sub></var> = <var title="">x</var></span> and <span><var title="">header<sub title="">y</sub></var> ≤ <var title="">slot<sub title="">y</sub></var> < <var title="">header<sub title="">y</sub></var>+<var title="">header<sub title="">height</sub></var></span>, to
- the <var title="">data cells</var> list.</p>
+ <li>
- </li>
+ <p>Remove any duplicates from the <var title="">header
+ list</var>.</p>
- <li>
+ </li>
- <p>Increase <var title="">x</var> by 1.</p>
+ <li>
- </li>
+ <p>Assign the headers in the <var title="">header list</var> to
+ the <var title="">principal cell</var>.</p>
- <li>
+ </li>
- <p>Jump up to the step above labeled <i>horizontal</i>.</p>
+ </ol><p>The <dfn id=internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning header
+ cells</dfn>, given a <var title="">principal cell</var>, a <var title="">header list</var>, a (<var title="">initial<sub title="">x</sub></var>, <var title="">initial<sub title="">y</sub></var>) initial coordinate, and Δ<var title="">x</var> and Δ<var title="">y</var> increments, is as
+ follows:</p>
- </li>
+ <ol><li>
- <li>
+ <p>Let <var title="">x</var> equal <var title="">initial<sub title="">x</sub></var>.</p>
- <p><i>Vertical</i>: If <var title="">y</var> is equal to
- <var title="">y<sub title="">height</sub></var>, then jump
- to the step below labeled <i>end</i>.</p>
+ </li>
- </li>
+ <li>
- <li>
+ <p>Let <var title="">y</var> equal <var title="">initial<sub title="">y</sub></var>.</p>
- <p>If there is a header cell <var title="">cell</var>
- anchored at (<var title="">header<sub title="">x</sub></var>, <var title="">y</var>), then follow
- these substeps:</p>
+ </li>
- <ol><li>
+ <li>
- <p>If the header cell <var title="">cell</var> is
- <a href=#equivalent-to-a-wide-cell>equivalent to a wide cell</a>, then let <var title="">width</var> be <span><var title="">x<sub title="">width</sub></var>-<var title="">header<sub title="">x</sub></var></span>. Otherwise, let <var title="">width</var> be the width of the header cell <var title="">cell</var>.</p>
+ <p>Let <var title="">opaque headers</var> be an empty list of
+ cells.</p>
- </li>
+ </li>
- <li>
+ <li>
- <p>If <var title="">width</var> is equal to <var title="">header<sub title="">width</sub></var>, then jump
- to the step below labeled <i>end</i>.</p>
+ <dl class=switch><dt>If <var title="">principal cell</var> is a header cell</dt>
- </li>
+ <dd><p>Let <var title="">in header block</var> be true, and let
+ <var title="">headers from current header block</var> be a list
+ of cells containing just the <var title="">principal
+ cell</var>.</dd>
- </ol></li>
+ <dt>Otherwise</dt>
- <li>
+ <dd><p>Let <var title="">in header block</var> be false and let
+ <var title="">headers from current header block</var> be an
+ empty list of cells.</p>
- <p>Add all the data cells that cover slots with coordinates
- (<var title="">slot<sub title="">x</sub></var>, <var title="">slot<sub title="">y</sub></var>), where <span><var title="">header<sub title="">x</sub></var> ≤ <var title="">slot<sub title="">x</sub></var> < <var title="">header<sub title="">x</sub></var>+<var title="">header<sub title="">width</sub></var></span> and
- <span><var title="">slot<sub title="">y</sub></var> = <var title="">y</var></span>, to the <var title="">data
- cells</var> list.</p>
+ </dl></li>
- </li>
+ <li>
- <li>
+ <p><i>Loop</i>: Increment <var title="">x</var> by Δ<var title="">x</var>; increment <var title="">y</var> by Δ<var title="">y</var>.</p>
- <p>Increase <var title="">y</var> by 1.</p>
+ <p class=note>For each invocation of this algorithm, one of
+ Δ<var title="">x</var> and Δ<var title="">y</var> will
+ be −1, and the other will be 0.</p>
- </li>
+ </li>
- <li>
+ <li>
- <p>Jump up to the step above labeled <i>vertical</i>.</p>
+ <p>If either <var title="">x</var> or <var title="">y</var> is
+ less than 0, then abort this internal algorithm.</p>
- </li>
+ </li>
- <li>
+ <li>
- <p><i>End</i>: Coalesce all the duplicate entries in the
- <var title="">data cells</var> list, so that each data cell
- is only present once, in tree order.</p>
+ <p>If there is no cell covering slot (<var title="">x</var>,
+ <var title="">y</var>), or if there is more than one cell
+ covering slot (<var title="">x</var>, <var title="">y</var>),
+ return to the substep marked <i>loop</i>.</p>
- </li>
+ </li>
- </ol></dd>
+ <li>
- </dl></li>
+ <p>Let <var title="">current cell</var> be the cell covering
+ slot (<var title="">x</var>, <var title="">y</var>).</p>
- <li>
+ </li>
- <p>Assign the header cell to all the data cells in the <var title="">data cells</var> list that correspond to
- <code><a href=#the-td-element>td</a></code> elements that do not have a <code title=attr-td-headers><a href=#attr-td-headers>headers</a></code> attribute specified.</p>
+ <li>
- </li>
+ <dl class=switch><dt>If <var title="">current cell</var> is a header cell</dt>
- </ol></li>
+ <dd>
- <li>
+ <ol><li><p>Set <var title="">in header block</var> to
+ true.</li>
- <p>For each data cell in the table, in <a href=#tree-order>tree order</a>,
- run these substeps:</p>
+ <li><p>Add <var title="">current cell</var> to <var title="">headers from current header block</var>.</li>
- <ol><li>
+ <li><p>Let <var title="">blocked</var> be false.</li>
- <p>If the data cell corresponds to a <code><a href=#the-td-element>td</a></code> element
- that does not have a <code title=attr-td-headers><a href=#attr-td-headers>headers</a></code> attribute specified, then
- skip these substeps and move on to the next data cell (if
- any).</p>
+ <li>
- </li>
+ <dl class=switch><dt>If Δ<var title="">x</var> is 0</dt>
- <li>
+ <dd>
- <p>Otherwise, take the value of the <code title=attr-td-headers><a href=#attr-td-headers>headers</a></code> attribute and <a href=#split-a-string-on-spaces title="split a string on spaces">split it on spaces</a>,
- letting <var title="">id list</var> be the list of tokens
- obtained.</p>
+ <p>If there is no cell in the <var title="">opaque
+ headers</var> list anchored with the same <var title="">x</var>-coordinate as the <var title="">current
+ cell</var>, and with the same width as <var title="">current
+ cell</var>, then let <var title="">blocked</var> be
+ true.</p>
- </li>
+ <p>If the <var title="">current cell</var> is not a
+ <a href=#column-header>column header</a>, then let <var title="">blocked</var> be true.</p>
- <li>
+ </dd>
- <!-- XXX if nothing was added to this subalgorithm, then make it
- a single paragraph instead of a nested list. -->
+ <dt>If Δ<var title="">y</var> is 0</dt>
- <p>For each token in the <var title="">id list</var>, run the
- following steps:</p>
+ <dd>
- <ol><li><p>Let <var title="">id</var> be the token.</li>
+ <p>If there is no cell in the <var title="">opaque
+ headers</var> list anchored with the same <var title="">y</var>-coordinate as the <var title="">current
+ cell</var>, and with the same height as <var title="">current cell</var>, then let <var title="">blocked</var> be true.</p>
- <li><p>If there is a header cell in the <a href=#concept-table title=concept-table>table</a> whose corresponding
- <code><a href=#the-th-element>th</a></code> element has an ID that is equal to the value of
- <var title="">id</var>, then assign the first such header cell
- in tree order to the data cell.</li>
+ <p>If the <var title="">current cell</var> is not a
+ <a href=#row-header>row header</a>, then let <var title="">blocked</var> be true.</p>
- </ol></li>
+ </dd>
- </ol></li>
+ </dl></li>
- </ol><p>A header cell anchored at (<var title="">header<sub title="">x</sub></var>, <var title="">header<sub title="">y</sub></var>) with width <var title="">header<sub title="">width</sub></var> and height <var title="">header<sub title="">height</sub></var> is said to be <dfn id=equivalent-to-a-wide-cell>equivalent to a wide
- cell</dfn> if all the slots with coordinates (<var title="">slot<sub title="">x</sub></var>, <var title="">slot<sub title="">y</sub></var>), where <span><var title="">header<sub title="">x</sub></var>+<var title="">header<sub title="">width</sub></var> ≤ <var title="">slot<sub title="">x</sub></var> < <var title="">x<sub title="">width</sub></var></span> and <span><var title="">header<sub title="">y</sub></var> ≤ <var title="">slot<sub title="">y</sub></var> < <var title="">header<sub title="">y</sub></var>+<var title="">header<sub title="">height</sub></var></span>, are all either empty or covered
- by <a href=#empty-data-cell title="empty data cell">empty data cells</a>.</p>
+ <li><p>If <var title="">blocked</var> is false, then add the
+ <var title="">current cell</var> to the <var title="">headers
+ list</var>.</li>
- <p>A data cell is said to be an <dfn id=empty-data-cell>empty data cell</dfn> if it
- contains no elements and its text content, if any, consists only of
+ </ol></dd>
+
+ <dt>If <var title="">current cell</var> is a data cell and <var title="">in header block</var> is true</dt>
+
+ <dd><p>Set <var title="">in header block</var> to false. Add
+ all the cells in <var title="">headers from current header
+ block</var> to the <var title="">opaque headers</var> list, and
+ empty the <var title="">headers from current header block</var>
+ list.</p>
+
+ </dl></li>
+
+ <li>
+
+ <p>Return to the step marked <i>loop</i>.</p>
+
+ </li>
+
+ </ol><p>A header cell anchored at the slot with coordinate (<var title="">x</var>, <var title="">y</var>) with width <var title="">width</var> and height <var title="">height</var> is said
+ to be a <dfn id=column-header>column header</dfn> if any of the following conditions
+ are true:</p>
+
+ <ul><li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute
+ is in the <a href=#attr-th-scope-col title=attr-th-scope-col>column</a> state</li>
+
+ <li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute
+ is in the <a href=#attr-th-scope-auto title=attr-th-scope-auto>auto</a> state, and
+ there are no data cells in any of the cells covering slots with
+ <var title="">y</var>-coordinates <var title="">y</var>
+ .. <span><var title="">y</var>+<var title="">height</var>-1</span>.</li>
+
+ </ul><p>A header cell anchored at the slot with coordinate (<var title="">x</var>, <var title="">y</var>) with width <var title="">width</var> and height <var title="">height</var> is said
+ to be a <dfn id=row-header>row header</dfn> if any of the following conditions
+ are true:</p>
+
+ <ul><li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute
+ is in the <a href=#attr-th-scope-row title=attr-th-scope-row>row</a> state</li>
+
+ <li>The cell's <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute
+ is in the <a href=#attr-th-scope-auto title=attr-th-scope-auto>auto</a> state, and
+ the cells is not a <a href=#column-header>column header</a>, and there are no
+ data cells in any of the cells covering slots with <var title="">x</var>-coordinates <var title="">x</var> .. <span><var title="">x</var>+<var title="">width</var>-1</span>.</li>
+
+ </ul><p>A header cell is said to be a <dfn id=column-group-header>column group header</dfn> if
+ its <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the
+ <a href=#attr-th-scope-colgroup title=attr-th-scope-colgroup>column group</a> state.</p>
+
+ <p>A header cell is said to be a <dfn id=row-group-header>row group header</dfn> if
+ its <code title=attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the
+ <a href=#attr-th-scope-rowgroup title=attr-th-scope-rowgroup>row group</a> state.</p>
+
+ <p>A cell is said to be an <dfn id=empty-cell>empty cell</dfn> if it contains no
+ elements and its text content, if any, consists only of
<a href=#white_space>White_Space</a> characters.</p>
- <p>User agents may remove <a href=#empty-data-cell title="empty data cell">empty data
- cells</a> when analyzing data in a <a href=#concept-table title=concept-table>table</a>.</p>
-
<h3 id=forms><span class=secno>4.10 </span>Forms</h3>
<p>Forms allow unscripted client-server interaction: given a form, a
Modified: source
===================================================================
--- source 2008-12-19 06:38:56 UTC (rev 2546)
+++ source 2008-12-20 09:21:43 UTC (rev 2547)
@@ -24531,44 +24531,24 @@
<dt>Element-specific attributes:</dt>
<dd><code title="attr-tdth-colspan">colspan</code></dd>
<dd><code title="attr-tdth-rowspan">rowspan</code></dd>
- <dd><code title="attr-td-headers">headers</code></dd>
- <!-- XXXv2 char, to specify the decimal character used in numeric cells -->
+ <dd><code title="attr-tdth-headers">headers</code></dd>
+ <!-- v2 char, to specify the decimal character used in numeric cells -->
<dt>DOM interface:</dt>
<dd>
- <pre class="idl">interface <dfn>HTMLTableDataCellElement</dfn> : <span>HTMLTableCellElement</span> {
- attribute DOMString <span title="dom-td-headers">headers</span>;
-};</pre>
+ <pre class="idl">interface <dfn>HTMLTableDataCellElement</dfn> : <span>HTMLTableCellElement</span> {};</pre>
</dd>
</dl>
<p>The <code>td</code> element represents a data <span
title="concept-cell">cell</span> in a table.</p>
- <p>The <code>td</code> element may have a <dfn
- title="attr-td-headers"><code>headers</code></dfn> content attribute
- specified. The <code title="attr-td-headers">headers</code>
- attribute, if specified, must contain a string consisting of an
- <span>unordered set of unique space-separated tokens</span>, each of
- which must have the value of an ID of a <code>th</code> element
- taking part in the same <span title="concept-table">table</span> as
- the <code>td</code> element (as defined by the <span>table
- model</span>).</p>
-
- <p>The exact effect of the attribute is described in detail in the
- <span>algorithm for assigning header cells to data cells</span>,
- which user agents must apply to determine the relationships between
- data cells and header cells.</p>
-
- <p>The <code>td</code> element and its <code
- title="attr-tdth-colspan">colspan</code> and <code
- title="attr-tdth-rowspan">rowspan</code> attributes take part in the
+ <p class="note">The <code>td</code> element and its <code
+ title="attr-tdth-colspan">colspan</code>, <code
+ title="attr-tdth-rowspan">rowspan</code>, and <code
+ title="attr-tdth-headers">headers</code> attributes take part in the
<span>table model</span>.</p>
- <p>The <dfn title="dom-td-headers"><code>headers</code></dfn> DOM
- attribute must <span>reflect</span> the content attribute of the
- same name.</p>
-
<h4>The <dfn><code>th</code></dfn> element</h4>
<dl class="element">
@@ -24581,6 +24561,7 @@
<dt>Element-specific attributes:</dt>
<dd><code title="attr-tdth-colspan">colspan</code></dd>
<dd><code title="attr-tdth-rowspan">rowspan</code></dd>
+ <dd><code title="attr-tdth-headers">headers</code></dd>
<dd><code title="attr-th-scope">scope</code></dd>
<dt>DOM interface:</dt>
<dd>
@@ -24604,30 +24585,38 @@
<dt>The <dfn title="attr-th-scope-row"><code>row</code></dfn>
keyword, which maps to the <i>row</i> state</dt>
- <dd>The <i>row</i> state means the header cell applies to all the
- remaining cells in the row.</dd>
+ <dd>The <i>row</i> state means the header cell applies to some of
+ the subsequent cells in the same row(s).</dd>
<dt>The <dfn title="attr-th-scope-col"><code>col</code></dfn>
keyword, which maps to the <i>column</i> state</dt>
- <dd>The <i>column</i> state means the header cell applies to all
- the remaining cells in the column.</dd>
+ <dd>The <i>column</i> state means the header cell applies to some
+ of the subsequent cells in the same column(s).</dd>
<dt>The <dfn
title="attr-th-scope-rowgroup"><code>rowgroup</code></dfn> keyword,
which maps to the <i>row group</i> state</dt>
- <dd>The <i>row group</i> state means the header cell applies to
- all the remaining cells in the row group.</dd>
+ <dd>The <i>row group</i> state means the header cell applies to all
+ the remaining cells in the row group. A <code>th</code> element's
+ <code title="attr-th-scope">scope</code> attribute must not be in
+ the <span title="attr-th-scope-rowgroup">row group</span> state if
+ the element is not anchored in a <span
+ title="concept-row-group">row group</span>.</dd>
<dt>The <dfn
title="attr-th-scope-colgroup"><code>colgroup</code></dfn> keyword,
which maps to the <i>column group</i> state</dt>
- <dd>The <i>column group</i> state means the header cell applies
- to all the remaining cells in the column group.</dd>
+ <dd>The <i>column group</i> state means the header cell applies to
+ all the remaining cells in the column group. A <code>th</code>
+ element's <code title="attr-th-scope">scope</code> attribute must
+ not be in the <span title="attr-th-scope-colgroup">column
+ group</span> state if the element is not anchored in a <span
+ title="concept-column-group">column group</span>.</dd>
- <dt>The <i>auto</i> state</dt>
+ <dt>The <dfn title="attr-th-scope-auto">auto</dfn> state</dt>
<dd>The <i>auto</i> state makes the header cell apply to a set of
cells selected based on context.</dd>
@@ -24637,14 +24626,11 @@
<p>The <code title="attr-th-scope">scope</code> attribute's
<i>missing value default</i> is the <i>auto</i> state.</p>
- <p>The exact effect of these values is described in detail in the
- <span>algorithm for assigning header cells to data cells</span>,
- which user agents must apply to determine the relationships between
- data cells and header cells.</p>
-
- <p>The <code>th</code> element and its <code
- title="attr-tdth-colspan">colspan</code> and <code
- title="attr-tdth-rowspan">rowspan</code> attributes take part in the
+ <p class="note">The <code>th</code> element and its <code
+ title="attr-tdth-colspan">colspan</code>, <code
+ title="attr-tdth-rowspan">rowspan</code>, <code
+ title="attr-tdth-headers">headers</code>, and <code
+ title="attr-th-scope">scope</code> attributes take part in the
<span>table model</span>.</p>
<p>The <dfn title="dom-th-scope"><code>scope</code></dfn> DOM
@@ -24664,6 +24650,22 @@
attribute specified, whose value must be a <span>valid non-negative
integer</span>.</p>
+ <p>The <code>td</code> and <code>th</code> element may have a <dfn
+ title="attr-tdth-headers"><code>headers</code></dfn> content
+ attribute specified. The <code
+ title="attr-tdth-headers">headers</code> attribute, if specified,
+ must contain a string consisting of an <span>unordered set of unique
+ space-separated tokens</span>, each of which must have the value of
+ an ID of a <code>th</code> element taking part in the same <span
+ title="concept-table">table</span> as the <code>td</code> or
+ <code>th</code> element (as defined by the <span>table
+ model</span>).</p>
+
+ <p class="note">The <code title="attr-tdth-colspan">colspan</code>,
+ <code title="attr-tdth-rowspan">rowspan</code>, and <code
+ title="attr-tdth-headers">headers</code> attributes take part in the
+ <span>table model</span>.</p>
+
<p>The <code>td</code> and <code>th</code> elements implement
interfaces that inherit from the <code>HTMLTableCellElement</code>
interface:</p>
@@ -24671,6 +24673,7 @@
<pre class="idl">interface <dfn>HTMLTableCellElement</dfn> : <span>HTMLElement</span> {
attribute long <span title="dom-tdth-colSpan">colSpan</span>;
attribute long <span title="dom-tdth-rowSpan">rowSpan</span>;
+ attribute DOMString <span title="dom-tdth-headers">headers</span>;
readonly attribute long <span title="dom-tdth-cellIndex">cellIndex</span>;
};</pre>
@@ -24686,6 +24689,10 @@
attribute as a non-negative integer</span> returns an error, is also
1.</p>
+ <p>The <dfn title="dom-tdth-headers"><code>headers</code></dfn> DOM
+ attribute must <span>reflect</span> the content attribute of the
+ same name.</p>
+
<p>The <dfn title="dom-tdth-cellIndex"><code>cellIndex</code></dfn>
DOM attribute must, if the element has a parent <code>tr</code>
element, return the index of the cell's element in the parent
@@ -24729,10 +24736,13 @@
title="">y</var> < <var title="">cell<sub
title="">y</sub></var>+<var title="">height</var></span>. Cells can
either be <em>data cells</em> or <em>header cells</em>. Data cells
- correspond to <code>td</code> elements, and have zero or more
- associated header cells. Header cells correspond to <code>th</code>
- elements.</p>
+ correspond to <code>td</code> elements, and header cells correspond
+ to <code>th</code> elements. Cells of both types can have zero or
+ more associated header cells.</p>
+ <p>It is possible, in certain error cases, for two cells to occupy
+ the same slot.</p>
+
<p>A <dfn title="concept-row">row</dfn> is a complete set of slots
from <span><var title="">x</var>=0</span> to <span><var
title="">x</var>=<var title="">x<sub
@@ -25437,11 +25447,12 @@
<p>If the <var title="">current cell</var> element is a
<code>th</code> element, let this new cell <var title="">c</var>
- be a header cell; otherwise, let it be a data cell. To establish
- what header cells apply to a data cell, use the <span>algorithm
- for assigning header cells to data cells</span> described in the
- next section.</p>
+ be a header cell; otherwise, let it be a data cell.</p>
+ <p>To establish which header cells apply to the <var
+ title="">current cell</var> element, use the <span>algorithm for
+ assigning header cells</span> described in the next section.</p>
+
<p>If any of the slots involved already had a <span
title="concept-cell">cell</span> covering them, then this is a
<span>table model error</span>. Those slots now have two cells
@@ -25510,413 +25521,435 @@
<h5 id="header-and-data-cell-semantics">Forming relationships between data cells and header cells</h5>
- <p>Each data cell can be assigned zero or more header cells. The
- <dfn>algorithm for assigning header cells to data cells</dfn> is as
- follows.</p>
+ <p>Each cell can be assigned zero or more header cells. The
+ <dfn>algorithm for assigning header cells</dfn> to a cell <var
+ title="">principal cell</var> is as follows.</p>
<ol>
+
+ <!-- INITIALIZATION -->
+
<li>
- <p>For each header cell in the table, in <span>tree order</span>,
- run these substeps:</p>
+ <p>Let <var title="">header list</var> be an empty list of
+ cells.</p>
- <ol>
+ </li>
- <li>
+ <li>
- <p>Let (<var title="">header<sub title="">x</sub></var>, <var
- title="">header<sub title="">y</sub></var>) be the coordinate of
- the slot to which the header cell is anchored.</p>
+ <p>Let (<var title="">principal<sub title="">x</sub></var>, <var
+ title="">principal<sub title="">y</sub></var>) be the coordinate
+ of the slot to which the <var title="">principal cell</var> is
+ anchored.</p>
- </li>
+ </li>
- <li>
+ <li>
- <p>Let <var title="">header<sub title="">width</sub></var> be
- the width of the header cell.</p>
+ <dl class="switch">
- </li>
+ <dt>If the <var title="">principal cell</var> has a <code
+ title="attr-tdth-headers">headers</code> attribute specified</dt>
- <li>
+ <dd>
- <p>Let <var title="">header<sub title="">height</sub></var> be
- the height of the header cell.</p>
+ <!-- HEADERS="" -->
- </li>
+ <ol>
- <li>
+ <li>
- <p>Let <var title="">data cells</var> be a list of data cells,
- initially empty.</p>
+ <p>Take the value of the <var title="">principal cell</var>'s
+ <code title="attr-tdth-headers">headers</code> attribute and
+ <span title="split a string on spaces">split it on
+ spaces</span>, letting <var title="">id list</var> be the list
+ of tokens obtained.</p>
- </li>
+ </li>
- <li>
+ <li>
- <p>Examine the <code title="attr-th-scope">scope</code>
- attribute of the <code>th</code> element corresponding to the
- header cell, and, based on its state, apply the appropriate
- substep:</p>
+ <!-- support headers="" to <td> for legacy compat -->
+ <!-- note that it's not conforming though -->
+ <p>For each token in the <var title="">id list</var>, if the
+ first element in the <code>Document</code> with an ID equal to
+ the token is a cell in the same <span
+ title="concept-table">table</span>, and that cell is not the
+ <var title="">principal cell</var>, then add that cell to <var
+ title="">header list</var>.</p>
- <dl class="switch">
+ </li>
- <dt>If it is in the <i title="attr-th-scope-row">row</i> state</dt>
+ </ol>
- <dd>
+ </dd>
- <p>Add all the data cells that cover slots with coordinates
- (<var title="">slot<sub title="">x</sub></var>, <var
- title="">slot<sub title="">y</sub></var>), where <span><var
- title="">header<sub title="">x</sub></var>+<var
- title="">header<sub
- title="">width</sub></var> ≤ <var
- title="">slot<sub title="">x</sub></var> < <var
- title="">x<sub title="">width</sub></var></span> and
- <span><var title="">header<sub
- title="">y</sub></var> ≤ <var title="">slot<sub
- title="">y</sub></var> < <var title="">header<sub
- title="">y</sub></var>+<var title="">header<sub
- title="">height</sub></var></span>, to the <var title="">data
- cells</var> list.</p>
- </dd>
+ <dt>If <var title="">principal cell</var> does not have a <code
+ title="attr-tdth-headers">headers</code> attribute specified</dt>
- <dt>If it is in the <i title="attr-th-scope-col">column</i> state</dt>
+ <dd>
- <dd>
+ <ol>
- <p>Add all the data cells that cover slots with coordinates
- (<var title="">slot<sub title="">x</sub></var>, <var
- title="">slot<sub title="">y</sub></var>), where <span><var
- title="">header<sub title="">x</sub></var> ≤ <var
- title="">slot<sub title="">x</sub></var> < <var
- title="">header<sub title="">x</sub></var>+<var
- title="">header<sub title="">width</sub></var></span> and
- <span><var title="">header<sub title="">y</sub></var>+<var
- title="">header<sub
- title="">height</sub></var> ≤ <var
- title="">slot<sub title="">y</sub></var> < <var
- title="">y<sub title="">height</sub></var></span>, to the <var
- title="">data cells</var> list.</p>
+ <li>
- </dd>
+ <p>Let <var title="">principal<sub title="">width</sub></var>
+ be the width of the <var title="">principal cell</var>.</p>
- <dt>If it is in the <i title="attr-th-scope-rowgroup">row group</i> state</dt>
+ </li>
- <dd>
+ <li>
- <p>If the header cell is not in a <span
- title="concept-row-group">row group</span>, then do
- nothing.</p>
+ <p>Let <var title="">principal<sub title="">height</sub></var>
+ be the height of the <var title="">principal cell</var>.</p>
- <p>Otherwise, let (0, <var title="">group<sub
- title="">y</sub></var>) be the slot at which the row group is
- anchored, let <var title="">height</var> be the number of rows
- in the row group, and add all the data cells that cover slots
- with coordinates (<var title="">slot<sub
- title="">x</sub></var>, <var title="">slot<sub
- title="">y</sub></var>), where <span><var title="">header<sub
- title="">x</sub></var> ≤ <var title="">slot<sub
- title="">x</sub></var> < <var title="">x<sub
- title="">width</sub></var></span> and <span><var
- title="">header<sub title="">y</sub></var> ≤ <var
- title="">slot<sub title="">y</sub></var> < <var
- title="">group<sub title="">y</sub></var>+<var
- title="">height</var></span>, to the <var title="">data
- cells</var> list.</p>
+ </li>
- </dd>
- <dt>If it is in the <i title="attr-th-scope-colgroup">column group</i> state</dt>
+ <!-- HORIZONTAL -->
- <dd>
+ <li>
- <p>If the header cell is not anchored in a <span
- title="concept-column-group">column group</span>, then do
- nothing.</p>
+ <p>For each value of <var title="">y</var> from <var
+ title="">principal<sub title="">y</sub></var> to <span><var
+ title="">principal<sub title="">y</sub></var>+<var
+ title="">principal<sub title="">height</sub></var>-1</span>,
+ run the <span>internal algorithm for scanning and assigning
+ header cells</span>, with the <var title="">principal
+ cell</var>, the <var title="">header list</var>, the initial
+ coordinate (<var title="">principal<sub
+ title="">x</sub></var>,<var title="">y</var>), and the
+ increments <span>Δ<var title="">x</var>=−1</span>
+ and <span>Δ<var title="">y</var>=0</span>.</p>
- <p>Otherwise, let (<var title="">group<sub
- title="">x</sub></var>, 0) be the slot at which that column
- group is anchored, let <var title="">width</var> be the number
- of columns in the column group, and add all the data cells
- that cover slots with coordinates (<var title="">slot<sub
- title="">x</sub></var>, <var title="">slot<sub
- title="">y</sub></var>), where <span><var title="">header<sub
- title="">x</sub></var> ≤ <var title="">slot<sub
- title="">x</sub></var> < <var title="">group<sub
- title="">x</sub></var>+<var title="">width</var></span> and
- <span><var title="">header<sub
- title="">y</sub></var> ≤ <var title="">slot<sub
- title="">y</sub></var> < <var title="">y<sub
- title="">height</sub></var></span>, to the <var title="">data
- cells</var> list.</p>
+ </li>
- </dd>
- <dt>Otherwise, it is in the <i title="">auto</i> state</dt>
+ <!-- VERTICAL -->
- <dd>
+ <li>
- <p>Run these steps:</p>
+ <p>For each value of <var title="">x</var> from <var
+ title="">principal<sub title="">x</sub></var> to <span><var
+ title="">principal<sub title="">x</sub></var>+<var
+ title="">principal<sub title="">width</sub></var>-1</span>,
+ run the <span>internal algorithm for scanning and assigning
+ header cells</span>, with the <var title="">principal
+ cell</var>, the <var title="">header list</var>, the initial
+ coordinate (<var title="">x</var>,<var title="">principal<sub
+ title="">y</sub></var>), and the increments <span>Δ<var
+ title="">x</var>=0</span> and <span>Δ<var
+ title="">y</var>=−1</span>.</p>
- <ol>
+ </li>
- <li>
- <p>If the header cell is <span>equivalent to a wide
- cell</span>, let <var title="">header<sub
- title="">width</sub></var> equal <span><var title="">x<sub
- title="">width</sub></var>-<var title="">header<sub
- title="">x</sub></var></span>.</p>
+ <!-- ROW GROUP HEADERS -->
- </li>
+ <li>
- <li>
+ <p>If the <var title="">principal cell</var> is anchored in a
+ <span title="concept-row-group">row group</span>, then add all
+ header cells that are <span title="row group header">row group
+ headers</span> and are anchored in the same row group with an
+ <var title="">x</var>-coordinate less than or equal to
+ <span><var title="">principal<sub title="">x</sub></var>+<var
+ title="">principal<sub title="">width</sub></var>-1</span> and
+ a <var title="">y</var>-coordinate less than or equal to
+ <span><var title="">principal<sub title="">y</sub></var>+<var
+ title="">principal<sub title="">height</sub></var>-1</span> to
+ <var title="">header list</var>.</p>
- <p>Let <var title="">x</var> equal <span><var
- title="">header<sub title="">x</sub></var>+<var
- title="">header<sub title="">width</sub></var></span>.</p>
+ </li>
- </li>
- <li>
+ <!-- COLUMN GROUP HEADERS -->
- <p>Let <var title="">y</var> equal <span><var
- title="">header<sub title="">y</sub></var>+<var
- title="">header<sub title="">height</sub></var></span>.</p>
+ <li>
- </li>
+ <p>If the <var title="">principal cell</var> is anchored in a
+ <span title="concept-column-group">column group</span>, then
+ add all header cells that are <span title="column group
+ header">column group headers</span> and are anchored in the
+ same column group with an <var title="">x</var>-coordinate
+ less than or equal to <span><var title="">principal<sub
+ title="">x</sub></var>+<var title="">principal<sub
+ title="">width</sub></var>-1</span> and a <var
+ title="">y</var>-coordinate less than or equal to <span><var
+ title="">principal<sub title="">y</sub></var>+<var
+ title="">principal<sub title="">height</sub></var>-1</span> to
+ <var title="">header list</var>.</p>
- <li>
+ </li>
- <p><i>Horizontal</i>: If <var title="">x</var> is equal to
- <var title="">x<sub title="">width</sub></var>, then jump
- down to the step below labeled <i>vertical</i>.</p>
+ </ol>
- </li>
+ </dd>
- <li>
+ </dl>
- <p>If there is a header cell anchored at (<var
- title="">x</var>, <var title="">header<sub
- title="">y</sub></var>) with height <var title="">header<sub
- title="">height</sub></var>, then jump down to the step
- below labeled <i>vertical</i>.</p>
+ </li>
- </li>
- <li>
+ <!-- CLEANUP -->
- <p>Add all the data cells that cover slots with coordinates
- (<var title="">slot<sub title="">x</sub></var>, <var
- title="">slot<sub title="">y</sub></var>), where <span><var
- title="">slot<sub title="">x</sub></var> = <var
- title="">x</var></span> and <span><var title="">header<sub
- title="">y</sub></var> ≤ <var title="">slot<sub
- title="">y</sub></var> < <var
- title="">header<sub title="">y</sub></var>+<var
- title="">header<sub title="">height</sub></var></span>, to
- the <var title="">data cells</var> list.</p>
+ <li>
- </li>
+ <p>Remove all the <span title="empty cell">empty cells</span> from
+ the <var title="">header list</var>.</p>
- <li>
+ </li>
- <p>Increase <var title="">x</var> by 1.</p>
+ <li>
- </li>
+ <p>Remove any duplicates from the <var title="">header
+ list</var>.</p>
- <li>
+ </li>
- <p>Jump up to the step above labeled <i>horizontal</i>.</p>
+ <li>
- </li>
+ <p>Assign the headers in the <var title="">header list</var> to
+ the <var title="">principal cell</var>.</p>
- <li>
+ </li>
- <p><i>Vertical</i>: If <var title="">y</var> is equal to
- <var title="">y<sub title="">height</sub></var>, then jump
- to the step below labeled <i>end</i>.</p>
+ </ol>
- </li>
+ <p>The <dfn>internal algorithm for scanning and assigning header
+ cells</dfn>, given a <var title="">principal cell</var>, a <var
+ title="">header list</var>, a (<var title="">initial<sub
+ title="">x</sub></var>, <var title="">initial<sub
+ title="">y</sub></var>) initial coordinate, and Δ<var
+ title="">x</var> and Δ<var title="">y</var> increments, is as
+ follows:</p>
- <li>
+ <ol>
- <p>If there is a header cell <var title="">cell</var>
- anchored at (<var title="">header<sub
- title="">x</sub></var>, <var title="">y</var>), then follow
- these substeps:</p>
+ <li>
- <ol>
+ <p>Let <var title="">x</var> equal <var title="">initial<sub
+ title="">x</sub></var>.</p>
- <li>
+ </li>
- <p>If the header cell <var title="">cell</var> is
- <span>equivalent to a wide cell</span>, then let <var
- title="">width</var> be <span><var title="">x<sub
- title="">width</sub></var>-<var title="">header<sub
- title="">x</sub></var></span>. Otherwise, let <var
- title="">width</var> be the width of the header cell <var
- title="">cell</var>.</p>
+ <li>
- </li>
+ <p>Let <var title="">y</var> equal <var title="">initial<sub
+ title="">y</sub></var>.</p>
- <li>
+ </li>
- <p>If <var title="">width</var> is equal to <var
- title="">header<sub title="">width</sub></var>, then jump
- to the step below labeled <i>end</i>.</p>
+ <li>
- </li>
+ <p>Let <var title="">opaque headers</var> be an empty list of
+ cells.</p>
- </ol>
+ </li>
- </li>
+ <li>
- <li>
+ <dl class="switch">
- <p>Add all the data cells that cover slots with coordinates
- (<var title="">slot<sub title="">x</sub></var>, <var
- title="">slot<sub title="">y</sub></var>), where <span><var
- title="">header<sub
- title="">x</sub></var> ≤ <var title="">slot<sub
- title="">x</sub></var> < <var
- title="">header<sub title="">x</sub></var>+<var
- title="">header<sub title="">width</sub></var></span> and
- <span><var title="">slot<sub
- title="">y</sub></var> = <var
- title="">y</var></span>, to the <var title="">data
- cells</var> list.</p>
+ <dt>If <var title="">principal cell</var> is a header cell</dt>
- </li>
+ <dd><p>Let <var title="">in header block</var> be true, and let
+ <var title="">headers from current header block</var> be a list
+ of cells containing just the <var title="">principal
+ cell</var>.</p></dd>
- <li>
+ <dt>Otherwise</dt>
- <p>Increase <var title="">y</var> by 1.</p>
+ <dd><p>Let <var title="">in header block</var> be false and let
+ <var title="">headers from current header block</var> be an
+ empty list of cells.</p>
- </li>
+ </dl>
- <li>
+ </li>
- <p>Jump up to the step above labeled <i>vertical</i>.</p>
+ <li>
- </li>
+ <p><i>Loop</i>: Increment <var title="">x</var> by Δ<var
+ title="">x</var>; increment <var title="">y</var> by Δ<var
+ title="">y</var>.</p>
- <li>
+ <p class="note">For each invocation of this algorithm, one of
+ Δ<var title="">x</var> and Δ<var title="">y</var> will
+ be −1, and the other will be 0.</p>
- <p><i>End</i>: Coalesce all the duplicate entries in the
- <var title="">data cells</var> list, so that each data cell
- is only present once, in tree order.</p>
+ </li>
- </li>
+ <li>
- </ol>
+ <p>If either <var title="">x</var> or <var title="">y</var> is
+ less than 0, then abort this internal algorithm.</p>
- </dd>
+ </li>
- </dl>
+ <li>
- </li>
+ <p>If there is no cell covering slot (<var title="">x</var>,
+ <var title="">y</var>), or if there is more than one cell
+ covering slot (<var title="">x</var>, <var title="">y</var>),
+ return to the substep marked <i>loop</i>.</p>
- <li>
+ </li>
- <p>Assign the header cell to all the data cells in the <var
- title="">data cells</var> list that correspond to
- <code>td</code> elements that do not have a <code
- title="attr-td-headers">headers</code> attribute specified.</p>
+ <li>
- </li>
+ <p>Let <var title="">current cell</var> be the cell covering
+ slot (<var title="">x</var>, <var title="">y</var>).</p>
- </ol>
-
</li>
<li>
- <p>For each data cell in the table, in <span>tree order</span>,
- run these substeps:</p>
+ <dl class="switch">
- <ol>
+ <dt>If <var title="">current cell</var> is a header cell</dt>
- <li>
+ <dd>
- <p>If the data cell corresponds to a <code>td</code> element
- that does not have a <code
- title="attr-td-headers">headers</code> attribute specified, then
- skip these substeps and move on to the next data cell (if
- any).</p>
+ <ol>
- </li>
+ <li><p>Set <var title="">in header block</var> to
+ true.</p></li>
- <li>
+ <li><p>Add <var title="">current cell</var> to <var
+ title="">headers from current header block</var>.</p></li>
- <p>Otherwise, take the value of the <code
- title="attr-td-headers">headers</code> attribute and <span
- title="split a string on spaces">split it on spaces</span>,
- letting <var title="">id list</var> be the list of tokens
- obtained.</p>
+ <li><p>Let <var title="">blocked</var> be false.</p></li>
- </li>
+ <li>
- <li>
+ <dl class="switch">
- <!-- XXX if nothing was added to this subalgorithm, then make it
- a single paragraph instead of a nested list. -->
+ <dt>If Δ<var title="">x</var> is 0</dt>
- <p>For each token in the <var title="">id list</var>, run the
- following steps:</p>
+ <dd>
- <ol>
+ <p>If there is no cell in the <var title="">opaque
+ headers</var> list anchored with the same <var
+ title="">x</var>-coordinate as the <var title="">current
+ cell</var>, and with the same width as <var title="">current
+ cell</var>, then let <var title="">blocked</var> be
+ true.</p>
- <li><p>Let <var title="">id</var> be the token.</p></li>
+ <p>If the <var title="">current cell</var> is not a
+ <span>column header</span>, then let <var
+ title="">blocked</var> be true.</p>
- <li><p>If there is a header cell in the <span
- title="concept-table">table</span> whose corresponding
- <code>th</code> element has an ID that is equal to the value of
- <var title="">id</var>, then assign the first such header cell
- in tree order to the data cell.</p></li>
+ </dd>
+ <dt>If Δ<var title="">y</var> is 0</dt>
+
+ <dd>
+
+ <p>If there is no cell in the <var title="">opaque
+ headers</var> list anchored with the same <var
+ title="">y</var>-coordinate as the <var title="">current
+ cell</var>, and with the same height as <var
+ title="">current cell</var>, then let <var
+ title="">blocked</var> be true.</p>
+
+ <p>If the <var title="">current cell</var> is not a
+ <span>row header</span>, then let <var
+ title="">blocked</var> be true.</p>
+
+ </dd>
+
+ </dl>
+
+ </li>
+
+ <li><p>If <var title="">blocked</var> is false, then add the
+ <var title="">current cell</var> to the <var title="">headers
+ list</var>.</p></li>
+
</ol>
- </li>
+ </dd>
- </ol>
+ <dt>If <var title="">current cell</var> is a data cell and <var title="">in header block</var> is true</dt>
+ <dd><p>Set <var title="">in header block</var> to false. Add
+ all the cells in <var title="">headers from current header
+ block</var> to the <var title="">opaque headers</var> list, and
+ empty the <var title="">headers from current header block</var>
+ list.</p>
+
+ </dl>
+
</li>
+ <li>
+
+ <p>Return to the step marked <i>loop</i>.</p>
+
+ </li>
+
</ol>
- <p>A header cell anchored at (<var title="">header<sub
- title="">x</sub></var>, <var title="">header<sub
- title="">y</sub></var>) with width <var title="">header<sub
- title="">width</sub></var> and height <var title="">header<sub
- title="">height</sub></var> is said to be <dfn>equivalent to a wide
- cell</dfn> if all the slots with coordinates (<var title="">slot<sub
- title="">x</sub></var>, <var title="">slot<sub
- title="">y</sub></var>), where <span><var title="">header<sub
- title="">x</sub></var>+<var title="">header<sub
- title="">width</sub></var> ≤ <var title="">slot<sub
- title="">x</sub></var> < <var title="">x<sub
- title="">width</sub></var></span> and <span><var title="">header<sub
- title="">y</sub></var> ≤ <var title="">slot<sub
- title="">y</sub></var> < <var title="">header<sub
- title="">y</sub></var>+<var title="">header<sub
- title="">height</sub></var></span>, are all either empty or covered
- by <span title="empty data cell">empty data cells</span>.</p>
+ <p>A header cell anchored at the slot with coordinate (<var
+ title="">x</var>, <var title="">y</var>) with width <var
+ title="">width</var> and height <var title="">height</var> is said
+ to be a <dfn>column header</dfn> if any of the following conditions
+ are true:</p>
- <p>A data cell is said to be an <dfn>empty data cell</dfn> if it
- contains no elements and its text content, if any, consists only of
+ <ul>
+
+ <li>The cell's <code title="attr-th-scope">scope</code> attribute
+ is in the <span title="attr-th-scope-col">column</span> state</li>
+
+ <li>The cell's <code title="attr-th-scope">scope</code> attribute
+ is in the <span title="attr-th-scope-auto">auto</span> state, and
+ there are no data cells in any of the cells covering slots with
+ <var title="">y</var>-coordinates <var title="">y</var>
+ .. <span><var title="">y</var>+<var
+ title="">height</var>-1</span>.</li>
+
+ </ul>
+
+ <p>A header cell anchored at the slot with coordinate (<var
+ title="">x</var>, <var title="">y</var>) with width <var
+ title="">width</var> and height <var title="">height</var> is said
+ to be a <dfn>row header</dfn> if any of the following conditions
+ are true:</p>
+
+ <ul>
+
+ <li>The cell's <code title="attr-th-scope">scope</code> attribute
+ is in the <span title="attr-th-scope-row">row</span> state</li>
+
+ <li>The cell's <code title="attr-th-scope">scope</code> attribute
+ is in the <span title="attr-th-scope-auto">auto</span> state, and
+ the cells is not a <span>column header</span>, and there are no
+ data cells in any of the cells covering slots with <var
+ title="">x</var>-coordinates <var title="">x</var> .. <span><var
+ title="">x</var>+<var title="">width</var>-1</span>.</li>
+
+ </ul>
+
+ <p>A header cell is said to be a <dfn>column group header</dfn> if
+ its <code title="attr-th-scope">scope</code> attribute is in the
+ <span title="attr-th-scope-colgroup">column group</span> state.</p>
+
+ <p>A header cell is said to be a <dfn>row group header</dfn> if
+ its <code title="attr-th-scope">scope</code> attribute is in the
+ <span title="attr-th-scope-rowgroup">row group</span> state.</p>
+
+ <p>A cell is said to be an <dfn>empty cell</dfn> if it contains no
+ elements and its text content, if any, consists only of
<span>White_Space</span> characters.</p>
- <p>User agents may remove <span title="empty data cell">empty data
- cells</span> when analyzing data in a <span
- title="concept-table">table</span>.</p>
-
<h3 id="forms">Forms</h3>
<p>Forms allow unscripted client-server interaction: given a form, a
More information about the Commit-Watchers
mailing list