W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2013

Event constructor defaults

From: Glenn Maynard <glenn@zewt.org>
Date: Mon, 11 Feb 2013 08:58:30 -0600
Message-ID: <CABirCh9ja4HLq3a8uEp_3sdCzOAmjcwB8iOoBpvhQifL-52PbA@mail.gmail.com>
To: www-dom@w3.org
There's a bit of a mistake in event constructors: by default, you get an
event with both the bubbles and cancelable flag cleared.  This is
backwards, since most of the time you want both of these flags set: almost
all events should bubble, and there's essentially no reason to ever create
an uncancellable event.  (The only time I ever do either of these is if I'm
mimicing a native event, where I'll set the same flags.)  This means every
use of event constructors becomes:

new Event("CustomEvent", { bubbles: true, cancelable: true });

which is a pain.  These should default to true, so new Event("CustomEvent")
does something reasonable.

Unfortunately, this is already implemented in Firefox and Chrome, but
changing these defaults might still be still web-compatible.

Glenn Maynard
Received on Monday, 11 February 2013 14:59:11 UTC

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