W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2014

Iterating over the properties of an ECMAScript object

From: Brian Birtles <bbirtles@mozilla.com>
Date: Thu, 17 Apr 2014 15:21:49 +0900
Message-ID: <534F72FD.9020305@mozilla.com>
To: public-script-coord@w3.org

In Web Animations we support a kind of open-ended dictionary so that 
authors can write:

   elem.animate({ opacity: '1', marginTop: '20px' }, 2000);

The keys 'offset' and 'marginTop' correspond to properties and 
attributes the UA can animate.

WebIDL doesn't allow this so we defined our own handling.[1]

To iterate over the passed in object's properties we decided to use 
Object.keys() so we only visit enumerable properties on the object 
itself. Does this seem reasonable? Or should we visit non-enumerable 
properties or properties on prototypes?

Best regards,


[1] http://dev.w3.org/fxtf/web-animations/#processing-a-keyframe-object
(Named anchors don't seem to work unless you reload the page, but it's 
section 5.15.2 Processing a Keyframe object)
Received on Thursday, 17 April 2014 06:22:17 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:21 UTC