Open Bug 176227 Opened 23 years ago Updated 3 years ago

Dynamically created listbox renders cells in wrong column

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
Linux
defect

Tracking

()

People

(Reporter: tlau-mozilla, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(3 files)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021015 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021015 The XUL contains a listbox with a single column and no rows. When the button is pressed, a new listitem with a single listcell child is added to the listbox. This new cell is added to the first row, but in the SECOND column. I expect it to be in the first column. This only happens when the listbox's initial size is bigger than the number of rows defined in the XUL. For example, if I hardcode five listitems into the XUL description of the listbox and set rows="5" and flex="0", then adding a row to the listbox works as expected. But setting flex="1" in the same example triggers the bug. Reproducible: Always Steps to Reproduce: Click on the "Add row" button in the testcase Actual Results: A row is added to the listbox, but the cell appears in the second column. Expected Results: The new cell should have appeared in the first (only) column of the listbox.
Isn't this what appendItem() or insertItemAt() on the <listbox> are for?
How are those supposed to work for listboxes with multiple columns? Isn't appendItem just shorthand for item = document.createElement('listitem'); listbox.appendChild(item); ?
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030202 Verified that this behavior occurs.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
I think you just need to run it to see the problem
I have another example fo what seems to be a very similar problem. The flexing of the columns and getting the content under the headings are both wrong. I have just submitted an attachment that shows the error and it can be seen at http://mail.gigaday.co.uk/mozilla-bug-176227/content/pacs.xul
The previous example was using Node.insertBefore; this one uses Node.appendChild, which makes it easier to understand and shows the problem in a slightly different way.
This is an XBL issue. When the listitem is added to the document its XBL is created which sees that it has no listcells and creates one. If you append the listcells to the listitem before appending the listitem then the XBL will not create an extra listcell.
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
I have observed that this is true only for the first row; any row, but the first would not automatically create a listcell. I think that adding automatically a listcell is fine as long as this is consistent for the whole listbox content, otherwise it is confusing. (In reply to comment #10) > This is an XBL issue. > > When the listitem is added to the document its XBL is created which sees that it > has no listcells and creates one. If you append the listcells to the listitem > before appending the listitem then the XBL will not create an extra listcell.
Just to clarify (from https://bugzilla.mozilla.org/show_bug.cgi?id=300687, Comment #3 From Dave Townsen) perhaps it is not restricted to row 1, but the initial size of the listbox.
Blocks: 300687
Assignee: general → nobody
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: