Closed Bug 5852 Opened 26 years ago Closed 26 years ago

document.getElementById('foo_id').selectedIndex returns negative values.

Categories

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

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: sdm, Assigned: kmcclusk)

References

()

Details

Go to the above url, and save the file locally. Then load it in apprunner. Select something other than Image for Back Button Display, and you will see -1 or -2 printed in the terminal winodw, and on the next line, undefined. It is counted backwards from 0, instead of forwards. I only tested this on linux.
I described it a bit incorrectly. It does not return the negative index, it returns -1 if an item is selected that is not the default item. If you set the default to the 3rd item (none), and click Create Theme, it returns 0, in which case 0 is the first in the list! This all used to work about a week ago.
Assignee: vidur → pollmann
Eric, do you know about any regressions (possibly at the widget level)?
Status: NEW → ASSIGNED
Target Milestone: M6
Haven't heard anything, I'll look into it.
This has since been fixed, atleast on the default build on linux. I think Ramiro's checkin today fixed this: http://cvs-mirror.mozilla.org/webtools/bonsai/cvsquery.cgi?module=all&branch=&branchtype=match&dir=&file=&filetype=match&who=ramiro%25netscape.com&whotype=match&sortby=Date&hours=2&date=explicit&mindate=05%2F03%2F99+14%3A00%3A00&maxdate=05%2F03%2F99+15%3A00%3A00&cvsroot=%2Fcvsroot But I'm not 100% sure. It could be that this is a problem with gfx widgets vs. native widgets.
That may be the problem. Ramiro switched Linux over from gfx to native widgets. Since this bug was only on Linux, and Linux was the only platform using gfx widgets by default, and the selectedIndex call relys on a widget correctly implementing getSelectedIndex... Thanks for the tip!
QA Contact: 4015 → 4078
QA Contact: 4078 → 4015
Yes, this is a gfx select widget problem. Using viewer, go to this URL: http://blueviper.mcom.com/forms/selectedIndex.html The page dumps "Initial selectedIndex=0" to the console. Change the widget render mode to Gfx (Debug->Style->Widget Render Mode->Gfx) Go to the same page. The page dumps "Initial selectedIndex=-1" to the console. Kevin, in forms/src/nsSelectControlFrame::GetProperty we query for the widget then call GetSelectedIndex on it. This obviously won't work for Gfx selects as they have no widget. I'm not familiar with the Gfx select code. What additional logic is necessary for them to report the correct selected element?
QA Contact: 4015 → 4078
Opps, I accidentally clobbered the QA Contact change - fixing...
Assignee: pollmann → kmcclusk
Status: ASSIGNED → NEW
Target Milestone: M6
Reassigning to the GFX widget guru.
Status: NEW → ASSIGNED
Target Milestone: M7
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Fixed in 5-27-99 2:46PM build. I added new code to correctly set and get the selectedindex for a gfx-combo box. Modified nsListboxControlFrame::SetProperty to toggle the selected index. Modified nsListboxControlFrame::GetProperty to return the selected index rather than looking at the selected attribute on the content.
Status: RESOLVED → VERIFIED
verified fixed on 1999-07-15-14 RedHat Linux 5.2 kernel 2.2.9
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.