Version: (using KDE KDE 3.1.2) Installed from: Gentoo Packages Compiler: gcc 3.2.2 OS: Linux I'm using javascript as part of a webapp project, and as part of that project, I track which cell a user has click in an html <table>. Using DOM methods, I lookup the cellIndex of the html element they clicked on. Opera, IE6, Mozilla1.3, and Netscape7 all return the expected value. Konqueror does not. Example: <html> <head> <title>blah</title> </head> <body> <table border=1> <tr> <td onclick="alert(this.cellIndex)">Test1</td> <td onclick="alert(this.cellIndex)">Test2</td> </tr> </table> </body> </html> In all the above browsers mentioned (except Konq, of course) clicking on 'Test1' brings up an alert box displaying '0', and clicking Test2 brings up an alert box display '1'. Konqueror, on the other hand, displays '0' in both cases. I believe this to be a bug.
Yes, cellIndex() is not implemented.
Better return this to the pool. I don't have time to finish it right now.
JFR: http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-84150186 cellIndex of type long, readonly The index of this cell in the row, starting from 0. This index is in document tree order and not display order.
Created attachment 7690 [details] Poposed patch Hi, The attached patch works for this testcase, but maybe it needs more testing? Cheers, Rob.
Applied the patch. Even if it weren't quite right it's better than nothing.
SVN commit 426346 by orlovich: justing in #khtml was looking at the cellIndex commit, and asked: could there be other tags then TD in a TR? The answer is yes, so using nodeIndex for cellIndex isn't quite right. This testcase shows the difference (and the baseline is right). Proper fix upcoming. CCBUG:58799 A baseline/unsorted/58799.html-dom AM baseline/unsorted/58799.html-dump.png A baseline/unsorted/58799.html-render A tests/unsorted/58799.html ** trunk/tests/khtmltests/regression/baseline/unsorted/58799.html-dump.png #property changes Name: svn:mime-type + application/octet-stream
SVN commit 426347 by orlovich: Make cellIndex not count tags != TD, TH when counting its index. Code essentially copies from the sectionRowIndex code from TRs. CCBUG:58799 M +11 -1 html_tableimpl.cpp --- trunk/KDE/kdelibs/khtml/html/html_tableimpl.cpp #426346:426347 @@ -791,7 +791,17 @@ long HTMLTableCellElementImpl::cellIndex() const { - return nodeIndex(); + int cIndex = 0; + const NodeImpl *n = this; + do { + n = n->previousSibling(); + if (n && (n->isElementNode() && n->id() == ID_TD || + n->isElementNode() && n->id() == ID_TH)) + cIndex++; + } + while (n); + + return cIndex; } void HTMLTableCellElementImpl::parseAttribute(AttributeImpl *attr)