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

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

From: Paul Bakaus <pbakaus@zynga.com>
Date: Mon, 28 Nov 2011 05:08:55 -0800
To: Dominic Cooney <dominicc@chromium.org>, "www-style@w3.org" <www-style@w3.org>, Sylvain Galineau <sylvaing@microsoft.com>, "dbaron@dbaron.org" <dbaron@dbaron.org>
Message-ID: <CAF9464A.12332%pbakaus@zynga.com>
Agree 100%. I don't see a point having this cumbersome API, having worked with it for a way too long time.

Von: Dominic Cooney <dominicc@chromium.org<mailto:dominicc@chromium.org>>
Datum: Tue, 8 Nov 2011 10:56:12 -0800
An: "www-style@w3.org<mailto:www-style@w3.org>" <www-style@w3.org<mailto:www-style@w3.org>>, Sylvain Galineau <sylvaing@microsoft.com<mailto:sylvaing@microsoft.com>>, "dbaron@dbaron.org<mailto:dbaron@dbaron.org>" <dbaron@dbaron.org<mailto:dbaron@dbaron.org>>
Betreff: [css3-animations][css3-transitions] AnimationEvent and TransitionEvent should have constructors and schew init methods

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);

This:

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. <http://dev.w3.org/html5/spec/Overview.html#hashchangeevent>

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

Dominic
Received on Monday, 28 November 2011 13:09:32 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:46 GMT