Closed
Bug 3340
Opened 26 years ago
Closed 25 years ago
compatibility: indexing into select for options.
Categories
(Core :: DOM: Core & HTML, defect, P2)
Tracking
()
M7
People
(Reporter: morse, Assigned: pollmann)
References
()
Details
The following content gives the correct values for the alert when run under 4.5
browser but gives incorrect values in 5.0. Specifically:
selectName.selectedIndex: 4.5 = 0 5.0 = -1
selectName[0].value: 4.5 = option1 5.0 = <javascript error>
Note: This might be the same bug as 3285 but until someone makes that
determination I am filing this as a separate bug report. Bug 3285 involved
frames filled in dynamically by javascript's document.write whereas this bug
involves frames that exist from the start. I was trying this as a work-around
to bug 3285 thinking that the dynamic frames might have been the problem.
Let me stress that these two bugs are currently blocking problems in developing
the client-side wallet application.
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM name=formName>
<TABLE>
<TR>
<TD>
<SELECT name=selectName>
<OPTION VALUE=option1 SELECTED> one </OPTION>
</SELECT><BR>
</TD>
</TR>
</TABLE>
</FORM>
<SCRIPT>
alert(document.formName.selectName.selectedIndex);
alert(document.formName.selectName[0].value);
</SCRIPT>
</BODY>
</HTML>
Updated•26 years ago
|
Assignee: norris → vidur
Comment 1•26 years ago
|
||
This is almost certainly in the DOM, not JavaScript.
Updated•26 years ago
|
Assignee: vidur → pollmann
Comment 2•26 years ago
|
||
Eric Pollmann is the right guy for DOM forms related bugs. Eric, Steve Morse is
blocked by this bug.
Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•26 years ago
|
||
The selectedIndex problem is indeed a bug. I'm on it.
However, according to the DOM spec, you can not access the options array by
indexing directly into the select element. Your javascript should read:
selectName.options[0].value
and NOT
selectName[0].value
This works in both 4.5 and 5.0 - is this an acceptable solution for that portion
of the problem?
Assignee | ||
Comment 4•26 years ago
|
||
More info on the selectedIndex bug:
You can work around this bug for the time being using a body onload tag. For an
example, see the above URL.
The DOM gets the selectedIndex by querying the frame, which has not been created
yet when your script is executed.
I'll change the select element to use the options array to determine the
selectedIndex in the case that the frame is not yet created.
Assignee | ||
Comment 5•26 years ago
|
||
I just checked in a fix to the selectedIndex problem.
Assignee | ||
Updated•26 years ago
|
Severity: major → normal
Summary: javascript gives wrong selectedIndex for a list → compatibility: indexing into select for options.
Assignee | ||
Comment 6•26 years ago
|
||
Since indexing into the select to get options is a compatibility issue, I'm
marking it as such.
Comment 7•26 years ago
|
||
per leger, assigning QA contacts to all open bugs without QA contacts according
to list at http://bugzilla.mozilla.org/describecomponents.cgi?product=Browser
QA contact re-assigned according to the product areas we're currently working
on.
Assignee | ||
Updated•26 years ago
|
Target Milestone: M7
Comment 10•25 years ago
|
||
Moving to DOM Level 0 component. Move to DOM Level 1 if that is more correct.
Assignee | ||
Updated•25 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
Assignee | ||
Comment 11•25 years ago
|
||
Since the only remaining issue here is treating
select[n] the same as select.options[n],
this is a dup of 2195.
*** This bug has been marked as a duplicate of 2195 ***
Updated•25 years ago
|
Status: RESOLVED → VERIFIED
Comment 12•25 years ago
|
||
Duplicate of Bug# 2195.
You need to log in
before you can comment on or make changes to this bug.
Description
•