W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2010

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

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 29 Oct 2010 11:07:28 +0200
To: "Jacob Rossi" <jrossi@microsoft.com>, "Cameron McCormack" <cam@mcc.id.au>
Cc: "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.vlbyaqhx64w2qv@anne-van-kesterens-macbook-pro.local>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:06 GMT