From 194c8fbd739692566bffed71215aaa5fbc75dd5b Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 22 Dec 2020 16:15:28 +0100 Subject: [PATCH] Allow null for return values of getters --- index.bs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 838d40c..4882d3b 100644 --- a/index.bs +++ b/index.bs @@ -209,7 +209,7 @@ interface SpeechRecognitionAlternative { [Exposed=Window] interface SpeechRecognitionResult { readonly attribute unsigned long length; - getter SpeechRecognitionAlternative item(unsigned long index); + getter SpeechRecognitionAlternative? item(unsigned long index); readonly attribute boolean isFinal; }; @@ -217,7 +217,7 @@ interface SpeechRecognitionResult { [Exposed=Window] interface SpeechRecognitionResultList { readonly attribute unsigned long length; - getter SpeechRecognitionResult item(unsigned long index); + getter SpeechRecognitionResult? item(unsigned long index); }; // A full response, which could be interim or final, part of a continuous response or not @@ -245,7 +245,7 @@ interface SpeechGrammar { interface SpeechGrammarList { constructor(); readonly attribute unsigned long length; - getter SpeechGrammar item(unsigned long index); + getter SpeechGrammar? item(unsigned long index); undefined addFromURI(DOMString src, optional float weight = 1.0); undefined addFromString(DOMString string, @@ -510,6 +510,7 @@ This structure has the following attributes:

item(index) getter
The item getter returns a SpeechGrammar from the index into an array of grammars. + If index is greater than or equal to length, this returns null. The user agent must ensure that the length attribute is set to the number of elements in the array. The user agent must ensure that the index order from smallest to largest matches the order in which grammars were added to the array.