- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 18 Dec 2012 11:23:41 -0800
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: public-webapps <public-webapps@w3.org>
On Tue, Dec 18, 2012 at 11:19 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote: > On 12/18/12 10:47 AM, Tab Atkins Jr. wrote: >> Makes sense, I guess (though I'm not super happy with having to >> explicitly add the empty string to every enum that's supposed to be >> "nullable"). In that case, the IDL would be: >> >> enum LightLevel { "dim", "normal", "bright", "" }; >> [Constructor (DOMString type, optional LightLevelEventInit eventInitDict)] >> interface LightLevelEvent : Event { >> readonly attribute LightLevel value; >> }; >> dictionary LightLevelEventInit : EventInit { >> LightLevel value = ""; >> }; > > > If you really want it nullable, why not make it nullable? As in: > > dictionary LightLevelEventInit : EventInit { > LightLevel? value = null; > }; > > This would incidentally work a lot better with { value: undefined } than the > proposal above... > > What am I missing? Anne pointed out in IRC that, when all the other values are strings, it is somewhat more convenient to have the "no value" value be a string as well, and the empty string is the obvious choice for that role. ~TJ
Received on Tuesday, 18 December 2012 19:24:28 UTC