array like objects

Mark S. Miller erights at google.com
Sat Dec 12 14:59:18 PST 2009


On Sat, Dec 12, 2009 at 12:29 PM, Garrett Smith <dhtmlkitchen at gmail.com>
wrote:
> Object.prototype.propertyIsEnumerable does not consider properties in
> the prototype chain. In effect, propertyIsEnumerable is a test to see
> if an object has *own* property that is also enumerable.

At the end of <
http://wiki.ecmascript.org/doku.php?id=conventions:isarraylike> I have added
the issue:

Unfortunately, the propertyIsEnumerable test above, despite the name,
actually tests whether a property is both enumerable and own. This means the
above predicate will reject objects that inherit a non-enumerable length
property. I can think of no reliable and portable ES3R test which tests only
property enumerability, except by running a for-in loop and testing the
output. Doing so would kill the bounded-by-constant time virtue.


Are we really this stuck? Can anyone think of a reliable, portable, and fast
ES3R test that tests whether a property is enumerable, whether it is
inherited or not?

-- 
   Cheers,
   --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20091212/5cc66d2e/attachment-0001.html>


More information about the es-discuss mailing list