Closed Bug 119401 Opened 23 years ago Closed 23 years ago

"SELECTED" item not displayed when select list contents modified

Categories

(Core :: Layout: Form Controls, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: gyoung, Assigned: john)

References

()

Details

I saw some similar bugs already noted, but this is slightly different to those noted. Apologies if this is a duplicate. If you view the source of the sample page you'll see what's happening - it's as stripped back as I could make it. Basically, "Value 2" should be shown as the visible item in the list-box, but instead the first item is shown. If you click on the list-box, and click outside the box (deselecting the list-box), the correct value is shown. If you comment out the JS, the select box displays as expected. The page works correctly with previous builds of Mozilla (including the Netscape 6.2 release).
Confirming with 20020102xx Mozilla binaries on WinNT, Linux. Very good testcase. Here is the source for it, for reference: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Mozilla Bug Example - Select List Selected Item &amp Javascript</title> </head> <body> <form name="a_form" action="" method="get"> <select name="a_select"> <option value="-">Value 1a</option> <option value="+" selected>Value 2</option> <option value="-">Value 3</option> </select> </form> <script language="JavaScript1.2" type="text/javascript"> document.forms[0]["a_select"].options[0].text = "Value 1b"; </script> </body> </html> The script changes the value of the 1st option from "Value 1a" to "Value1b". This is causing Mozilla to ignore that the 2nd option has the "selected" attribute. So when you load the testcase, "Value1b" shows in the selectbox. NN4.7, IE6 show "Value 2". And indeed, if you comment out the JavaScript, that's what Mozilla shows when it loads. Reassigning to HTML Form Controls; not sure if this it should be DOM Level 0. cc'ing jst, jkeiser in case they recognize this as a dupe of another bug -
Assignee: rogerl → rods
Status: UNCONFIRMED → NEW
Component: Javascript Engine → HTML Form Controls
Ever confirmed: true
OS: Windows 2000 → All
QA Contact: pschwartau → madhur
-->
Assignee: rods → jkeiser
Let's see what happens when bug 112241 lands; that hit this code directly.
Depends on: 112241
'Tis in fact fixed with bug 112241.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
QA Contact: madhur → tpreston
You need to log in before you can comment on or make changes to this bug.