Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7a) Gecko/20040218
If a <listbox> has a <listhead>, calls to removeItemAt() remove the wrong row.
The function seems to treat the <listhead> as item 0 and it treats the first
<listitem> as item 1, which is not consistent with how other functions like
getItemAtIndex() behave. Here is some sample code:
var list = document.getElementById('mylist');
<listheader label='My List'/>
<button label='Del' onclick='del()'/>
Clicking the button "Del" should remove the "one" item from the list, but it
removes the "zero" item instead. If you remove the "<listhead>...</listehead>"
the problem goes away.
Is there a way to work around this that won't break when the bug is fixed (i.e.
simply adding 1 to the index isn't a good work around since it will break)? I
tried looking at getIndexOfFirstVisibleRow(), but it returns 0 (instead of 1)
even when <listhead> is present.
Steps to Reproduce:
1. Implement the code given in the details.
2. Push the "Del" button
The "zero" item is removed.
The "one" item should be removed.
Actually, the presence of <listhead> isn't the only thing that causes problems.
<listcols> will do it to.
it attempts to remove this.childNodes[index], which is only the right thing to
do if ALL of the child nodes are "listitem" objects. If you have a <listhead>
or <listcols>, the child node with index 0 is not a listitem, so the wrong child
You are right, all the methods should getItemAtIndex instead of childNodes.
Created attachment 155125 [details]
Created attachment 155126 [details] [diff] [review]
according to comment 2
Fix checked in.
*** Bug 277498 has been marked as a duplicate of this bug. ***
This bug still exists in current versions of Firefox. (1.0.5) Could someone
please reopen this bug for current version of Firefox? If not, what should be
done? A new bug filed?
This is not going to be backported to the 1.0.x stable branch, it will be in the
next releases of Firefox and SeaMonkey.