Event constructor defaults

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