-
Notifications
You must be signed in to change notification settings - Fork 32
Review notes #5
Comments
Thanks for the thorough review!
Because I'm using
Certainly if the polyfill uses How would it be observable whether I'm using |
Step 5.a "If Type(key) is String, then " is required, but I was referring to step 5.a.iii.2.a "Let elementKey be ToString(key).". This step is redundant because "key" is always a string (per step 5.a).
Yes, I understand why a double array is needed here, but nonetheless there's a extraneous left bracket which needs to be removed. 😄
The difference is visible with the test case from https://bugzilla.mozilla.org/show_bug.cgi?id=1208464#c13: // Expected: Returns ["A"]
// Actual: Returns ["A", "B"]
Object.values({
get a() {
Object.defineProperty(this, "b", {enumerable: false});
return "A";
},
b: "B"
}); |
aha, thanks for clarifying. I wasn't referencing you're right that the brackets don't match up - I actually am missing the matching right bracket. Will fix. Thanks for the test case! I'll update that in the included polyfill (and the separate shims) shortly, and close this issue when I do. |
Ah sure. Maybe I should have read the code more carefully... -_- |
Agree about |
OK - that should cover all the issues you brought up. Please reopen, or file new ones, as you see fit! :-D |
@ljharb this case will not be passed with Object.values(Object.defineProperty({
get a() {
Object.defineProperty(this, 'b', {enumerable: true, value: 'C'});
return 'A';
}
}, 'b', {value: 'B', writable: true, configurable: true})); |
That test case isn't actually guaranteed to pass by the spec. There's a specific note already in the spec: "any added property during enumeration is not guaranteed to be included in the output" - I'll refine this to be "any property added or marked enumerable during enumeration" to be clearer. |
For I have no ideas how to fix this case with correct property order in all engines %) I think, I'll just replace |
If there's value in specifying it, I'm open to discussing that in a new issue and doing so - but I think it's fine to not overly proscribe the edge case of modifying properties mid-enumeration. |
http://ljharb.github.io/proposal-object-values-entries/#EnumerableOwnProperties
Step 5.a.iii.2.a is redundant, key is always a string.
The polyfill needs to use Object.getOwnPropertyNames and Object.prototype.propertyIsEnumerable instead of Object.keys and Object.prototype.hasOwnProperty to be compliant to the specification text.
And there is also a typo in Object.entries,
[[k, O[k]]
should be[k, O[k]]
:The text was updated successfully, but these errors were encountered: