Skip to content

HTMLSelectElement.options should be an HTMLOptionsCollection, not HTMLCollection #8220

Closed
@evmar

Description

@evmar

According to
https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement
the options property should be an HTMLOptionsCollection
https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionsCollection

Which is just like an HTMLCollection but all the options are HTMLOptionElement.
This allows code like

let select: HTMLSelectElement = ...;
console.log(select.options[0].value);

to work without needing to coerce select.options[0] to a HTMLOptionElement.

See also this (closed) issue for some background -- I think the type of this got a bit funky at one point due to a bug in Edge that was fixed: #1558

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions