W3C home > Mailing lists > Public > www-style@w3.org > November 2011

[css3-animations][css3-transitions] AnimationEvent and TransitionEvent should have constructors and schew init methods

From: Dominic Cooney <dominicc@chromium.org>
Date: Tue, 8 Nov 2011 10:56:12 -0800
Message-ID: <CAHnmYQ8xbt_O3P6BJ+fb4Nk5EpOp7r7JOz0eQ==vXhcBujPT4A@mail.gmail.com>
To: www-style@w3.org, Sylvain Galineau <sylvaing@microsoft.com>, dbaron@dbaron.org
I note that recent drafts of many specs—DOM4, HTML, Workers, WebSocket,
etc. specify events with constructors that take a dictionary of arguments,
and don’t specify an init*Event method. So instead of this:

var e = document.createEvent('TransitionEvent');
e.initEvent(type, false, true, 'background-color', 0.3);


new TransitionEvent(type, {
    bubbles: false,
    cancelable: true,
    propertyName: 'background-color',
    elapsedTime: 0.3

This is more convenient because it is a single expression and easier to
read because the arguments are effectively labeled by the hash properties.

You could look at the HashChangeEvent as a typical example of how the
constructor and dictionary are described in Web IDL. <

It would be nice if CSS3 Animations and CSS3 Transitions adopted this style
for events.

Received on Tuesday, 8 November 2011 19:02:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:07 UTC