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

On Mon, Sep 19, 2011 at 4:02 PM, David Flanagan <dflanagan@mozilla.com> 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.
>
> The reason I ask is that browsers (at least Firefox and Chrome, and possibly
> Safari) don't seem to implement it fully synchronously, and it is easy to
> hose them with thousands of calls to dispatchEvent().  Does HTML or some
> other spec override the DOM4 requirements?

Yup, this is very true. However it's no different from hosing the
browser using repeated calls to Array.map or writing code like
while(1) { /* do nothing */ }.

/ Jonas

Received on Monday, 19 September 2011 23:34:36 UTC