- From: James Craig <jcraig@apple.com>
- Date: Thu, 18 Apr 2013 12:55:47 -0700
- To: public-speech-api@w3.org
- Cc: Chris Fleizach <cfleizach@apple.com>
- Message-id: <EE2770A4-316E-4B05-AF3E-70475B6076C7@apple.com>
Seeing no response, I filed the bug here:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21744
On Apr 3, 2013, at 4:53 PM, James Craig <jcraig@apple.com> wrote:
> Speech utterance example missing "new" keyword.
> https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#examples-synthesis
>
>> speechSynthesis.speak(SpeechSynthesisUtterance('Hello World'));
>
>
> should be:
>
>> speechSynthesis.speak(new SpeechSynthesisUtterance('Hello World'));
>
> As it is currently written, it will throw a ~"constructor is not a function" error in WebKit.
>
> The working group might wish to consider if you want the constructor to return a value when called without the new keyword. For example, Date() returns a string value for the current datetime, or a Date object if prefixed with the “new" keyword.
>
> > Date()
> "Wed Apr 03 2013 16:40:46 GMT-0700 (PDT)"
> > new Date()
> Wed Apr 03 2013 16:40:46 GMT-0700 (PDT)
>
> > typeof Date()
> string
> > typeof new Date()
> object
>
> I’d lean toward making SpeechSynthesisUtteranceConstructor, when called as a function, return a SpeechSynthesisUtterance instance (effectively making the new keyword optional) but I don’t believe the current spec allows this. I may be wrong.
>
> Thanks,
> James Craig
>
Received on Thursday, 18 April 2013 19:56:32 UTC