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. ~TJReceived on Tuesday, 18 December 2012 19:24:28 GMT
This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:56 GMT