Closed
Bug 152874
Opened 23 years ago
Closed 23 years ago
add method of HTML SelectElement doesn't appear to work
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: mwexler, Assigned: jst)
References
()
Details
var secondaryMenu = (theMenu.selectedIndex-1);
menu2 = document.getElementById(targetMenu);
var end=menu2.length;
for (i=0; i < end; i++) {
menu2.remove(0);
}
i=0;
for (i=0; i < menu[secondaryMenu][0].length; i++) {
var newElem = document.createElement("OPTION");
newElem.text = menu[secondaryMenu][text][i];
newElem.value = menu[secondaryMenu][value][i];
menu2.add(newElem);
}
}
the menu2.add should add the option element to menu2. But it doesn't appear to.
Instead there is only one entry with a value of "c"
This works on MSIE 6.0 and follows the spec at
http://www.w3.org/TR/2002/CR-DOM-Level-2-HTML-20020605/DOM2-HTML.html#html-ID-30606413
Updated•23 years ago
|
QA Contact: desale → stummala
Comment 1•23 years ago
|
||
The code in the testcase is incorrect... it has:
menu2.add(newElem);
while at
http://www.w3.org/TR/2002/CR-DOM-Level-2-HTML-20020605/DOM2-HTML.html#html-ID-94282980
we see that the add() method takes _2_ arguments:
void add(in HTMLElement element,
in HTMLElement before)
raises(DOMException);
Not passing that second argument causes add() to throw the following exception:
[Exception... "Not enough arguments [nsIDOMHTMLSelectElement.add]"]
Marking bug invalid; if I fix the call to add() to be correct it works fine.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Updated•15 years ago
|
Component: DOM: Abstract Schemas → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•