From HTML WG Wiki
< ChangeProposals
Revision as of 19:21, 25 February 2010 by Sfaulkne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Cell API


This proposal outlines additions to the DOM interface for table elements (and children of table elements) to expand the methods available for interacting with tables and to make the outcomes of those interactions more consistent. This proposal also suggests clarifications to the Tabular Data Processing Model.


At the moment, there is not a direct method for retrieving a collection of cells that form an implied column. Methods exist to retrieve rows (table.row returns an HTMLCollection of tr elements). Assuming that applications will want to insert and delete columns as well as rows, this proposal mirrors the row functionality for columns.


Edits to section 4.9.1 The table element

Add the following to the section "DOM interface" at the beginning of section 4.9.1:

 readonly attribute HTMLCollection columns; 
 HTMLElement insertColumn (in optional long index);
 void deleteColumn(in long index);

Later in section 4.9.1, the DOM interface is elaborated. Add the following:

 Returns an HTMLCollection of the td or th elements in columns (whether the columns are explicitly or implicitly defined)
 col = table.insertColumn(index)
 Creates a td element in each tr element at the position given by the argument and returns the column.
 Removes the td and/or th elements with the given position in the table.
 The position is relative to the columns in the table. The index -1 is equivalent to deleting the last column of the table.
 If the given position is less that -1 or greater than the index of the last column, or if there are no columns, 
 throws an INDEX SIZE ERR exception.


  • Not sure we want to return a col when we insert a column...but not sure how to do this if we don't have a pointer to the new column... perhaps a colgroup?
  • What happens when the new columns comes in between a cell that spans columns? Same question for insert.Row--what happens when there is a cell that spans rows?

After the paragraph that begins, "When the deleteRow(index) method is called, the user agent must run..." insert:

 The columns attribute must return an isn't clear how the collection should be formed.
 Insert a col element to attach the cells to? What if a previous row spans 2 such that tr[0] has 3 ths while tr[1] 
 only has 2 tds. What should be returned for table.columns(1)? This should mirror the paragraph that starts "The rows
 attribute must return an HTMLCollection..."
 The behavior of the insertColumn(index) method depends on the state of the table. When it is called,
 the method must act as required by the first item in the following list of conditions that describes the
 state of the table and the index argument:
 If ... mirror the section that starts "The behavior of insertRow(index)..."
 When the deleteColumn(index) method is called, the user agent must run the following steps:
 1. If index ... mirror the section that starts "When the deleteRow(index) method is called..."

Edits to section 4.9.3 The colgroup element

Mirror tbody methods? e.g., colgroup.columns? tbody.insertColumn([index])? tbody.deleteColumn(index) Mirror tr methods? colgroup.sectionColumnIndex, colgroup.cells?

Edits to section 4.9.5 The tbody element

Add column methods to get collection of columns, insertColumn, and deleteColumn?


Positive Effects

  • List advantages

Negative Effects

  • List disadvantages

Conformance Classes Changes

Describe what conformance classes will have to change.


Describe any risks.


  • List references