- From: Anne van Kesteren <annevk@opera.com>
- Date: Wed, 14 Dec 2011 11:04:45 +0100
- To: "public-script-coord@w3.org" <public-script-coord@w3.org>, "Cameron McCormack" <cam@mcc.id.au>
On Wed, 14 Dec 2011 02:12:23 +0100, Cameron McCormack <cam@mcc.id.au>
wrote:
> Anyway, here's a suggestion:
>
> callback EventListener = void handleEvent(Event evt);
>
> interface EventTarget {
> void addEventListener(DOMString type, EventListener listener,
> bool useCapture);
> };
>
> That handles the (by far common case) of [Callback,NoInterfaceObject]
> being used on an interface with a single operation. It's an improvement
> over using "interface" IMO.
Agreed, looks pretty awesome to me!
> Also if someone knows of any interfaces that use a [Callback] with
> attributes on it, please let me know. It would simplify matters to drop
> support for that too.
http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-nodefilter
has them (sad face), but I am not really sure how that ends up being
exposed.
> For event listener attributes where they are required to be restricted
> only to Function objects (that is the case, yes?) we could write
>
> callback EventListener = void handleEvent(Event evt);
> [FunctionOnly] attribute EventListener onclick;
>
> or
>
> callback EventListener = void handleEvent(Event evt);
> typedef [FunctionOnly] EventListener EventListenerAttribute;
> attribute EventListenerAttribute onclick;
>
> to reduce a bit of repetition.
I think we should introduce a native IDL type "eventhandler" so you can
write
eventhandler onclick;
Event handlers are extremely common and worthy of such blessing, in my
opinion.
--
Anne van Kesteren
http://annevankesteren.nl/
Received on Wednesday, 14 December 2011 10:05:44 UTC