Closed Bug 96346 Opened 23 years ago Closed 23 years ago

SelectElem.options does not return HTMLCollection

Categories

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

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: jwbaker, Assigned: jst)

Details

(Keywords: dom1, testcase)

Attachments

(1 file, 2 obsolete files)

I will attach a testcase which causes the following exception in Mozilla 0.9.3:

Error: uncaught exception: [Exception... "Component returned failure code:
0x80004005 (NS_ERROR_FAILURE) [nsIDOMHTMLOptionElement.selected]"  nsresult:
"0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
file:///home/jwb/select.html :: <TOP_LEVEL> :: line 24"  data: no]

In the 2001-08-20 Linux nightly build, I do not get this exception, but also the
DOM code does not work as expected.  The expected behavior is for the page to
load and select "5" in the form element.  In 0.9.3 and latest nightly, this does
not happen.

If I test for selected == false before setting selected to false, the exception
does not occur.  I postulate that the problem is that one cannot set selected ==
false when no option is selected.  However that's just my guess.

This is needed for DOM 1 and DOM 2 compliance.
Attached file Testcase (obsolete) —
Keywords: dom1, testcase
I don't see the exception using a CVS build from the 08/30 on linux.
Attached file testcase (obsolete) —
no exception was raised but SelectElem.options does not return HTMLCollection.
Changing the summary accordingly. attached a testcase attachid 55970.
Summary: Uncaught exception when deselecting option → SelectElem.options does not return HTMLCollection
This seems to work fine for me in 0.9.5.  What build did you test?  I get:

Should alert HTMLCollection [object HTMLOptionCollection]
Should alert 1
i used 2001-10-30-12 build
This works for me Linux 2001103113.  I see the same behavior as Jeffrey.
Attached file more correct testcase
This is object, guys ... it doesn't matter what the string prints out, it
matters whether it is actually that type of object.  Since an object can
inherit multiple interfaces, there's no way to guarantee that toString() print
out the exact interface you want unless it prints them all.  (Actually
according to bz there's no requirement to print out *anything* in toString.)

This testcase tests instanceof, and works.
Attachment #46674 - Attachment is obsolete: true
Attachment #55970 - Attachment is obsolete: true
OK bug 92071 fixed the remaining issues which was that HTMLOptionCollection
didn't inherit from HTMLCollection but it's fixed now. Marking FIXED. Please
reopen if you find yet another issue :-)
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
verified fixed 2001-12-20-10, marking verified
Status: RESOLVED → VERIFIED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: