Re: [DOMCore] Making event initializing easier

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 UTC