Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11584 (new enhancement)

Opened 1 month ago

[PATCH] More robust Object.keys

Reported by: kangax Assigned to: sam
Priority: normal Milestone: 2.x
Component: Prototype Version: edge
Severity: normal Keywords:
Cc:

Description

As we know, for..in is borken in IE. IE skips a property of an object if there's a DontEnum property (with the same name) in the prototype chain.

This results in all kinds of nasty stuff in IE:

Object.keys({ toString: true }).length; // => 0
Object.keys({ toString: false, valueOf: 'foo' }).length; // => 0

This also affects Class.Methods.addMethods though not at such extent - (toString and valueOf are explicitly copied over, but the other "buggy" ones - hasOwnProperty, isPrototypeOf, etc. are left over)

Attachments

0014-More-robust-Object.keys.patch (2.2 kB) - added by kangax on 04/13/08 19:43:00.

Change History

04/13/08 19:43:00 changed by kangax

  • attachment 0014-More-robust-Object.keys.patch added.