W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2011

Re: [DOMCore] Making event initializing easier

From: Anne van Kesteren <annevk@opera.com>
Date: Thu, 23 Jun 2011 13:02:57 +0200
To: "Cameron McCormack" <cam@mcc.id.au>
Cc: "Doug Schepers" <schepers@w3.org>, "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.vxizm7xo64w2qv@anne-van-kesterens-macbook-pro.local>
On Thu, 23 Jun 2011 12:57:27 +0200, Cameron McCormack <cam@mcc.id.au>  
wrote:
> Minor suggestion: name the dictionaries something other than *Event,
> because that seems like an event interface name.  EventInitializer or
> EventParameters (and then CustomEventInitializer or
> CustomEventParameters, etc.).

EventInit?


> Also, I wonder if the event type should just be a plain argument outside
> the dictionary.  I think every event you dispatch needs a type.
>
>   var evt = document.createEvent("MouseEvent");
>   evt.init("click", { clientX: 100, clientY: 150 });
>
> looks OK to me.

Works for me.


> Does it make sense to provide event interfaces with constructors?  A
> pattern like:
>
>   elt.dispatchEvent(new MouseEvent("click", { clientX: 100,
>                                               clientY: 150 });
>
> looks even better. :-)

Baby steps :-)


-- 
Anne van Kesteren
http://annevankesteren.nl/
Received on Thursday, 23 June 2011 11:03:41 GMT

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