[webkit-dev] rowIndex on DOMHTMLTableRowElement returning -1

Jing Chen (Volt) a-jiche at microsoft.com
Tue Nov 20 09:13:01 PST 2007

Hi all,

I'm having an issue with [DOMHTMLTableRowElement rowIndex] returning -1 when I call it on a row. The DOM specification does not say anything about rowIndex returning negative indices. I thought that perhaps it was returning -1 for the last row in a table, but it looks like it's also returning -1 for the second row in a table with four rows.

I've checked that the element I'm calling rowIndex on is actually a DOMHTMLTableRowElement. Its parent is a DOMHTMLTableElement with no header and no footer, and checking the length of the DOMHTMLTableElement's rows property gives 4. If I check the 2nd element (index 1) of the DOMHTMLTableElement, it returns the DOMHTMLTableRowElement that I'm looking at.

More concretely, from the debugger:
(row is a DOMHTMLTableRowElement, tableRoot is a DOMHTMLTableElement)

(gdb) p (long)[row rowIndex]
$4 = -1
(gdb) p (int)[[tableRoot rows] length]
$5 = 4

(gdb) po [row parentNode]
<DOMHTMLTableElement [TABLE]: 0x14d00ae0 ''>
(gdb) po tableRoot
<DOMHTMLTableElement [TABLE]: 0x14d00ae0 ''>

(gdb) po row
<DOMHTMLTableRowElement [TR]: 0x14cfb480 ''>
(gdb) po [[tableRoot rows] item:1]
<DOMHTMLTableRowElement [TR]: 0x14cfb480 ''>

Can anyone tell me why rowIndex is returning -1?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webkit.org/pipermail/webkit-dev/attachments/20071120/db00edae/attachment.html

More information about the webkit-dev mailing list