(function foo(){}).propertyIsEnumerable("prototype"): true or false?

Mark S. Miller erights at google.com
Thu Sep 3 20:04:21 PDT 2009


On Thu, Sep 3, 2009 at 7:36 PM, Jeff Walden<jwalden+es at mit.edu> wrote:
> ES3, 15.3.5.2, says the prototype property of function instances is
> enumerable.
>
> ES5, 13.2 step 17, says the prototype property of function instances is not
> enumerable.
>
> Was this change intentional, and if so, can someone point me to discussion
> of the change?  I don't care one way or the other, but given past paranoia
> over incompatible changes, this change seems somewhat gratuitous.  Was this
> done to ease enumeration of properties on function instances, perhaps?
>  Maybe that's enough motivation, but I don't see natural use cases for doing
> so.

I don't remember discussing this. But if we had, our general principle
is that we first need to be compatible with the cross-browser web, and
only second with the text of the ES3 standard. A bit of testing
reveals that 'prototype' is enumerable on Firefox and not on Safari or
Opera. Someone with Windows should test IE. If it isn't enumerable on
IE, then the governing principle would be the three of four browsers
heuristic. If it is, then since the four browsers are split, either
decision is compatible with the cross browser web so we should codify
whatever seems most sensible.

-- 
    Cheers,
    --MarkM


More information about the es-discuss mailing list