W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2011

Re: [DOM4] EventTarget.dispatchEvent() is synchronous, right?

From: David Flanagan <dflanagan@mozilla.com>
Date: Tue, 20 Sep 2011 10:36:49 -0700
Message-ID: <4E78CF30.9080708@mozilla.com>
To: www-dom@w3.org
CC: Boris Zbarsky <bzbarsky@mit.edu>, Jonas Sicking <jonas@sicking.cc>, Ian Hickson <ian@hixie.ch>
Thanks for the confirmation that dispatchEvent() is synchronous.

And apologies: my concerns about asynchronous behavior was caused by a 
bug in my benchmark code that was causing exponential behavior in the 
browsers I was testing.  Everything is nice and synchronous now.

     David

On 9/19/11 7:17 PM, Boris Zbarsky wrote:
> On 9/19/11 7:02 PM, David Flanagan wrote:
>> My reading of the DOM4 spec is that EventTarget.dispatchEvent() is
>> completely synchronous and does not involve the event loop in any way
>> and that any event handlers triggered in response to the dispatched
>> event are invoked before dispatchEvent() returns to its caller.
>
> This is correct, yes.
>
>> The reason I ask is that browsers (at least Firefox and Chrome, and
>> possibly Safari) don't seem to implement it fully synchronously
>
> I would love to see your testcase.  To the best of my knowledge, 
> dispatchEvent is completely synchronous in Gecko.
>
> -Boris
>
Received on Tuesday, 20 September 2011 17:37:22 GMT

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