HTMLTableElement.insertRow(-1) ambiguous

The DOM TS is at odds with recent changes to the the HTML DOM.

Specifically, I'm referring to HTMLTableElement::insertRow and how it behaves with a rowIndex of -1.
The recent change to the spec was that rows are numbered in logical order (THEAD* TBODY+ TFOOT*) instead
of document/DTD order (THEAD* TFOOT* TBODY+) to conform with existing implementations.

insertRow(-1) is supposed to append a row to the table:
	"If index is -1 or equal to the number of rows, the new row is appended"
	<http://www.w3.org/TR/2002/PR-DOM-Level-2-HTML-20021108/html.html#ID-39872903>

The test case at http://dev.w3.org/cvsweb/2001/DOM-Test-Suite/tests/level2/html/HTMLTableElement39.xml
doesn't take this change into account.

From the description of insertRow(-1) -- as well as the previous behavior -- I surmise that the intent was to append a row to the last TBODY, not to the TFOOT. However, because the rows in a table are numbered with TFOOT rows at the end, it's not clear to which section insertRow should append: The last existing section? The TFOOT? The TBODY?

Our tests with Netscape 7 indicate that it doesn't support -1 as a parameter to insertRow.

My questions: what is the correct behavior, and should the spec be updated?

Brad Pettit
Microsoft Corp.

Received on Tuesday, 17 December 2002 17:40:22 UTC