- From: Dominic Cooney <dominicc@chromium.org>
- Date: Tue, 8 Nov 2011 10:56:12 -0800
- To: www-style@w3.org, Sylvain Galineau <sylvaing@microsoft.com>, dbaron@dbaron.org
Received on Tuesday, 8 November 2011 19:02:29 UTC
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 Tuesday, 8 November 2011 19:02:29 UTC