Closed
Bug 746077
Opened 13 years ago
Closed 12 years ago
cellIndex is -1 for th without a tr parent (should be 0 per current HTML5 draft)
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: colin, Unassigned)
References
Details
Attachments
(1 file)
4.72 KB,
text/html
|
Details |
I make a table through javascript and the DOM tree. I then try to get the cellIndex for a th from the table and I get -1 ...
Similar to bug https://bugzilla.mozilla.org/show_bug.cgi?id=255381 , however that bug claims cellIndex does work..
Updated•13 years ago
|
Attachment #615624 -
Attachment mime type: text/plain → text/html
Comment 1•13 years ago
|
||
Current spec draft at http://www.whatwg.org/specs/web-apps/current-work/multipage/tabular-data.html#dom-tdth-cellindex says:
The cellIndex IDL attribute must, if the element has a parent tr element, return the
index of the cell's element in the parent element's cells collection. If there is no
such parent element, then the attribute must return 0.
the <th> elements in this testcase are not inside a <tr>, so we should be returning 0. Looks like this is a recent spec change; DOM level 1 and 2 did not define behavior for cells that are not in a row, so we returned -1 in that case.
That said, compat across browsers is poor here: WebKit returns all sorts of different indices, while Opera seems to not implement this property at all. IE9 returns 0 like the current spec draft says, so I'm guessing hixie just went with the IE behavior for simplicity. Ms2ger, do you think it's worth making the case that returning an obviously invalid value when the value is meaningless is better, or should we just switch to 0?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: cellIndex is -1 for th from dynamic table → cellIndex is -1 for th without a tr parent (should be 0 per current HTML5 draft)
Comment 2•13 years ago
|
||
Comment 3•13 years ago
|
||
From code inspection, webkit returns the number of previous siblings that are th/td's.
Comment 4•13 years ago
|
||
Even if there is no parent table and other nodes in between so that the ths/tds end up in separate tables in the layout?
Comment 5•12 years ago
|
||
Spec changed.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•