Closed Bug 274113 Opened 20 years ago Closed 20 years ago

.remove method of <select> element doesn't work

Categories

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

1.7 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED WORKSFORME

People

(Reporter: email, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

According to the W3C HTML DOM specification,
http://www.w3.org/TR/1998/WD-DOM-19980416/level-one-html.html, should have the
following method:
void remove(in long index)
    Remove an element from the Select collection

This method doesn't work in Mozilla. The URL given leads to a page that
demonstrates the problem. It also has commented out a version of the function
used that does work in FireFox. (it uses regular XML DOM, not specific HTML DOM)

The method used does work in MS IE and is also described
(http://www.w3schools.com/htmldom/dom_obj_select.asp) and demonstrated in w3schools:
http://www.w3schools.com/js/tryit.asp?filename=try_dom_select_remove


Reproducible: Always
Steps to Reproduce:
1. Create a select box
2. write a function that tries to remove an option based on it's index, using
the .remove method
3. execute the function
Actual Results:  
No error message was given, but also on option was removed.

Expected Results:  
The option of the given index (in the example html file, the options that are
selected) should be removed from the select box.
This html file contains all the necessary code to reproduce the problem.
The same file can be found here:
http://philbert.nl/testSelectRemove.htm
not sure which DOM component this should be, but it's Core, not Firefox. reassign...
Assignee: firefox → general
Component: General → DOM: HTML
Product: Firefox → Core
QA Contact: firefox.general → ian
Version: unspecified → 1.7 Branch
the attached testcase works for me. The example at w3schools doesn't work
because they use
<select name="mySelect">
instead of correct
<select id="mySelect">

When I change that, it also works for me.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
The attached testcase works for me.
Mozilla 1.8a6 build 2004120706 and Firefox 1.0 rv: 1.7.5 build 20041107 under XP
Pro SP2.
Strange. I thought I had everything tested right through, but suddenly I can't
reproduce the error anymore.

I will have to find out what I did wrong before. In the meantime, this bug seems
unfounded.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
Status: RESOLVED → VERIFIED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: