Closed
Bug 86659
Opened 24 years ago
Closed 24 years ago
alteration of select widget by JavaScript broken
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
People
(Reporter: chris+bugzilla, Assigned: jst)
References
()
Details
Attachments
(1 file)
1006 bytes,
text/html
|
Details |
In Mozilla 0.9.1+ the ability for javascript to change the selected item in a
select form widget is broken. The referenced URL is a simplified test of this
bug which works under NS 4.7 and Moz 0.9.1 but is broken under Moz 0.9.1+
When you click the button on the page, "Item 2" (which is form.sel.option[2])
should become the selected option, but instead form.sel.option[0] is selected,
the default.
Comment 1•24 years ago
|
||
Confirming bug on WinNT 20020615xx. Platform/OS : Mac --> All.
Browser, not engine; reassigning to DOM Level 0.
Here is the HTML from the testcase:
<html>
<head>
<script>
var values = new Array('item1','item2','item3');
var labels = new Array('Item 1','Item 2','Item 3');
function changeSelects(form, newval)
{
// empty select, then load select
form.sel.length = 0;
form.sel.options[0] = new Option("select an item");
form.sel.options[0].value = "none";
var x = 1;
var sel = 0;
for (opt in values)
{
form.sel.options[form.sel.options.length] = new Option(labels[opt]);
form.sel.options[x].value = values[opt];
if (values[opt] == newval)
{
sel = x;
}
x++;
}
form.sel.options[sel].selected = "true";
}
</script>
</head>
<body>
<form>
<select name=sel>
<option value=none>Empty select</option>
</select>
<input type=button name=ChangeSelects value=ChangeSelects
onClick="changeSelects(this.form, 'item2')">
</form>
</body>
</html>
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: Javascript Engine → DOM Level 0
Ever confirmed: true
OS: Mac System 9.x → All
QA Contact: pschwartau → desale
Hardware: Macintosh → All
Comment 2•24 years ago
|
||
Comment 3•24 years ago
|
||
Compare bug 86287, where the addition of an alert changes the DOM behavior.
Comment 4•24 years ago
|
||
With the testcase in the URL bar, the selected element is correctly reported
into the DOM, but the change is not done in layout it seems. While in the second
attached testcase, the alert dialog will cause a reflow apparently. I wonder
whether this should not rather go to html form controls. CC'ing rods
Comment 5•24 years ago
|
||
oh of course I forgot to mention this is probably due to rods checkin for bug 53165
Is the same as/related to bug#61628, which is also concerned with javascript
selecting options?
Reporter | ||
Comment 7•24 years ago
|
||
Between trunk builds 20010720xx and 2001072408 there was further regression on
this bug. In the sample URL (see attachment), now not only does the select not
set properly, the select does not fill as it did before. Upon pressing button
the select empties.
Reporter | ||
Comment 8•24 years ago
|
||
Since posting that last note, and a browser restart, I've had the attached 6/19
test succeed, fail and succeed again. I've done enough activities, between
browsing, switching apps, reading mail, etc. that I can't identify a trigger. I
get a JS error of "Error: cmd_delete is not defined" when the new bug appears
however. Hope this helps...
Comment 9•24 years ago
|
||
Is there a workaround for this bug besides displaying an alert dialog between
the creation of the option and its selection?
Reporter | ||
Comment 10•24 years ago
|
||
As of today's build (2001081708), this bug is fixed for me (the reporter).
Thanks to everyone who worked on this bug! From my point of view, the
resolution of this bug makes Mozilla eligible for v1.0.
Chris
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•