[whatwg] proposal: Add support for masking to canvas

Boris Zbarsky bzbarsky at MIT.EDU
Tue Jan 29 22:05:29 PST 2013

On 1/30/13 12:55 AM, Rik Cabanier wrote:
>        void maskImage(optional MaskOptions options);
> Why is it optional?

Because http://dev.w3.org/2006/webapi/WebIDL/#idl-operations says (if 
you scroll down a ways):

   If the type of an argument is a dictionary type or a union type that
   has a dictionary type as one of its flattened member types, and this
   argument is either the final argument or is followed by an optional
   argument, then the argument MUST be specified as optional.  Such
   arguments are always considered to have a default value of an empty
   dictionary, unless otherwise specified.

> It's not optional for 'addHitRegion' in the spec either...

Well, then whenever someone tries to actually parse that IDL with a 
WebIDL parser/validator they'll come filing bugs.  ;)


More information about the whatwg mailing list