isPropertyEnumerable is going to stay broken?
bclary at mozilla.com
Sun Sep 16 21:27:48 PDT 2007
In a fairly limited scan totaling about 3000 pages of the homepages of
33 top sites including those pages linked from the homepages I found
three occurrences of essentially the same script:
where propertyIsEnumerable is used incorrectly (as a property rather
than as a function) but which appears to have intended to get the "don't
search prototype" behavior.
Due to the nature of the scan (using the narcissus parser in the
browser), the scan was fairly slow. I can use a different approach and
cover more pages if there is more interest. If not, I'll let this rest here.
Brendan Eich wrote:
> On Sep 8, 2007, at 10:06 PM, Garrett Smith wrote:
>> In this bug, dated 2000, Brendan and David agreed that
>> isPropertyEnumerable should check the prototype chain.
> That was a long time ago, and while David Flanagan carries a lot of
> weight with many folks, he was not on ECMA TC39 TG1, and no one on the
> group changed the spec.
> A lot of water under the bridge since then.
>> It should not backwards compatibility,
> Famous last words. :-)
> We try to spider the web (Alexa top 1000 and the like) looking for
> counterexamples to such claims, and if we fail to find any, or better,
> we find instances of confusion where the incompatible fix is assumed
> (i.e., the JS author thought the spec worked the way we want to change
> it to work), then we have some confidence, but not much more, in favor
> of making an incompatible change. In general. In this case, no one has
> done such a scan. I'll see if I can get one started.
>> but such functionality in the
>> language seems necessary. How to check enumerable attribute, including
>> the prototype chain?
> Either reflect the __proto__ (read-only, please) property as some
> implementations do, or hardcode the prototype structure and code your
> propertyIsEnumerable tests accordingly.
More information about the Es4-discuss