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

Re: Exceptions in event listeners triggered by dispatchEvent().

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 17 Jun 2013 21:27:14 +0000 (UTC)
To: Jonas Sicking <jonas@sicking.cc>
cc: Anne van Kesteren <annevk@annevk.nl>, "www-dom@w3.org" <www-dom@w3.org>, John Barton <johnjbarton@google.com>
Message-ID: <Pine.LNX.4.64.1306172124000.11139@ps20323.dreamhostps.com>
On Mon, 3 Jun 2013, Jonas Sicking wrote:
> I think it would be great if dispatchEvent dispatched the event at
> end-of-microtask or some such.

The usual pattern when dispatching an event is:

   <something happens>
   dispatch an event to notify user code!
   was the event canceled? if not, do the default action

It would be weird if this wasn't synchronous. I'm not really sure how you 
would do the default action. Certainly it would mean that the default 
action was no longer in the same task as the <something happens>, which is 
weird. Think about browser events (either by analogy or as a concrete 
example, depending on whether you'd want this to apply to all events or 
only those dispatched from script): you click on a checkbox, its .value 
changes, an event is fired, and if it's canceled, the .value is changed 
back. It'd be pretty weird if this happened asynchronously.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 17 June 2013 21:27:36 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:21 UTC