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

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

From: Glenn Maynard <glenn@zewt.org>
Date: Mon, 3 Jun 2013 20:00:21 -0500
Message-ID: <CABirCh8fAwTUv3s6eF56UjcioxMKK6=kD-ozzN4mynLGr8650w@mail.gmail.com>
To: John Barton <johnjbarton@google.com>
Cc: johnjbarton <johnjbarton@chromium.org>, "www-dom@w3.org" <www-dom@w3.org>, Anne van Kesteren <annevk@annevk.nl>
On Mon, Jun 3, 2013 at 7:36 PM, John Barton <johnjbarton@google.com> wrote:

>  Well the current API only gives our part of the result state: why don't
> the exceptions propagate?
> Why can't we have "dispatch(event)" that both returns your boolean and
> propagates exceptions?

Sorry, I don't follow.  If it returns the boolean, then the event listeners
must be run before the function returns.  (The return value tells you
whether any event listener called event.preventDefault().)  I don't know
what "propagating exceptions" would mean here, since multiple exceptions
might be thrown (multiple listeners).  I suppose it could mean "run all
listeners, then rethrow the first seen exception", but that seems weird to

(This is probably academic--I doubt that would be web-compatible
either--but I'm just trying to understand what you mean.)

I thought we established that dispatchEvent()'s behavior is not documented.
> What experience would I use other that years of experience in JavaScript?

I'm not sure what you're arguing, but improving documentation and specs is
much simpler than changing or adding new APIs (which would itself require
changes to specs).

You can do some of it yourself; MDN appears to be open to public editing:


(I suspect MDN is used by web developers much more often than reading the
spec, so if it's author confusion you're worried about, adding a sentence
in here will probably have more effect than any change to the spec.)

Glenn Maynard
Received on Tuesday, 4 June 2013 01:00:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:02 UTC