Re: [DOM3 Events] optional capture argument in add/removeEventListener [ISSUE-134]

On Fri, 29 Oct 2010 01:04:32 +0200, Cameron McCormack <cam@mcc.id.au>  
wrote:
> Jacob Rossi:
>> In regards to the question raised in the telecon about how to specify
>> optional parameters using WebIDL, Travis pointed out to me that there
>> isn't really a way to do this explicitly in WebIDL. However it can be
>> accomplished by specing an overload for add/removeEventListener which
>> lacks the useCapture argument. Then there would be text explaining
>> that calling this overload is equivalent to calling the 3-argument
>> add/removeEventListener method with useCapture set to false.
>
> Note that you can use the “optional” keyword to save writing an
> explicit, second operation.  It is equivalent to having two operations,
> but might save you some prose since there’s only one operation in the
> IDL.

I think the main saving would be a shorter IDL fragment, as you still need  
to say the omitted argument defaults to false and two separate definitions  
are not really necessary -- at least, I have not gotten that feedback on  
XMLHttpRequest. </pedant>


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Friday, 29 October 2010 09:08:32 UTC