TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

HTMLFormControlsCollection does not have string accessor

Open Paril opened this issue 4 years ago • 2 comments

As per the spec (https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormControlsCollection/namedItem), namedItem supports strings, but the accessor of HTMLFormControlsCollection is not updated to reflect this.

Paril avatar May 06 '21 19:05 Paril

This might have come in since then: https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/master/baselines/dom.generated.d.ts#L6701-L6708

/** A collection of HTML form control elements.  */
interface HTMLFormControlsCollection extends HTMLCollectionBase {
    /**
     * Returns the item with ID or name name from the collection.
     *
     * If there are multiple matching items, then a RadioNodeList object containing all those elements is returned.
     */
    namedItem(name: string): RadioNodeList | Element | null;
}

orta avatar Jun 28 '21 18:06 orta

@orta as far as I know, the indexers have always just been redirected to namedItem; for some reason, this is the only HTMLCollectionBase-derived class that doesn't also override the indexer. See https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#the-htmlformcontrolscollection-interface (which is supposedly where it appeared first in the spec) where the IDL indeed only mentions namedItem, but, below it it explains that the indexer redirects to it.

Paril avatar Jul 05 '21 06:07 Paril