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

Re: [whatwg] createEvent() in Web Workers?

From: Simon Pieters <simonp@opera.com>
Date: Mon, 30 Nov 2009 12:52:04 +0100
To: "Jonathan Cook" <jonathan.j5.cook@gmail.com>, WHATWG <whatwg@whatwg.org>
Cc: "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.u37hw2p7idj3kv@simon-pieterss-macbook.local>
On Fri, 27 Nov 2009 17:02:00 +0100, Simon Pieters <simonp@opera.com> wrote:

> An idea for creating events is to support [Constructor] on all event  
> IDLs, which makes the createEvent method unnecessary.
>
> Maybe we could even make the arguments to the constructor be called to  
> initFooEvent() directly, so instead of doing
>
>     var e = document.createEvent('MouseEvents');
>     e.initMouseEvent('click', ...);
>     foo.dispatchEvent(e);
>
> you could do
>
>     foo.dispatchEvent(new MouseEvent('click', ...))
>
>
> I've cc-ed www-dom since this is a suggestion for a change to DOM Events.

Another thing we could change is to make all but the first arguments to  
initFooEvent() optional and let them have sensible defaults, so that if  
all you care about is the event type, you can include just the first  
argument.

If the constructor is called with no arguments, then initFooEvent() would  
not be called.

-- 
Simon Pieters
Opera Software
Received on Monday, 30 November 2009 11:52:47 GMT

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