Object.keys/Object.values DontEnum IE fix
Reported by Juriy Zaytsev | April 17th, 2008 @ 05:39 AM | in 1.6.1
Relevant Trac ticket http://dev.rubyonrails.org/ticke...
Comments and changes to this ticket
-
Juriy Zaytsev April 17th, 2008 @ 05:40 AM
- no changes were found...
-
Juriy Zaytsev April 17th, 2008 @ 05:40 AM
- → State changed from new to bug_patch
-
Tobie Langel April 18th, 2008 @ 01:15 PM
- → State changed from bug_patch to bug
-
Juriy Zaytsev April 22nd, 2008 @ 02:09 AM
Do we also want to "skip" properties in prototype chain when enumerating over an object?
Currently, such filtering does not happen:
Object.keys(5); // => ["toColorPart", "succ", "times", "toPaddedString", "toJSON", "abs", "round", "ceil", "floor"] -
John-David Dalton April 22nd, 2008 @ 04:20 AM
+1 for skipping the "prototype" I think most users would assume that Object.keys would get the keys assigned to the object and not inherited.
-
Tobie Langel April 22nd, 2008 @ 11:52 AM
One of the use of
Object.keysis to be able to access prototypes.If you're planning to use an object as a hash, you should be using
Hash, notObject.So -1 on that last proposition.
-
Juriy Zaytsev April 22nd, 2008 @ 05:37 PM
@Tobie
So how would one find, let's say, only static methods of a class?
var Person = Class.create({ initialize: function(name, age) { this.name = name; this.age = Math.min(age, Person.MAX_AGE); Person.count++; } }) Person.count = 0; Person.MAX_AGE = 100; // this doesn't return only "static" properties as one might expect Object.keys(Person); -
Tobie Langel April 22nd, 2008 @ 02:36 PM
@Juriy: Well, if that's a requested feature,
Class.classMethodsseems like an appropriate solution. -
-
John-David Dalton May 29th, 2008 @ 04:35 AM
- → Milestone changed from to 1.6.0.3
-
John-David Dalton May 29th, 2008 @ 04:35 AM
- → Milestone changed from 1.6.0.3 to 1.6.1
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
The Prototype JavaScript library.
