Skip to content

Make SpeechGrammarList.item() nullable. - #212

Open
padenot wants to merge 1 commit into
mainfrom
nullable-grammar-item
Open

Make SpeechGrammarList.item() nullable.#212
padenot wants to merge 1 commit into
mainfrom
nullable-grammar-item

Conversation

@padenot

@padenot padenot commented Sep 8, 2026

Copy link
Copy Markdown
Member

The return type was non-nullable, so an index greater than or equal to length had no valid return value. Chromium declares it non-nullable too, but its implementation returns null for such an index, and other platform collections with an item() getter (NodeList, HTMLCollection, CSSRuleList, FileList) all declare it nullable, so specify null and match what ships.

I'm sending a Gecko patch that includes a WPT for this.


Preview | Diff

@padenot
padenot requested review from evanbliu and hoch September 8, 2026 12:44
Comment thread index.bs

@hoch hoch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The return type was non-nullable, so an index greater than or equal to
length had no valid return value. Chromium declares it non-nullable too,
but its implementation returns null for such an index, and other platform
collections with an item() getter (NodeList, HTMLCollection, CSSRuleList,
FileList) all declare it nullable, so specify null and match what ships.
@padenot
padenot force-pushed the nullable-grammar-item branch from 17decaa to 3f9e1f4 Compare September 8, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants