paulmillr / es6-shim

ECMAScript 6 compatibility shims for legacy JS engines
http://paulmillr.com
MIT License
3.11k stars 389 forks source link

Simplify `getPropertyDescriptor` #309

Closed maxim-grishaev closed 9 years ago

maxim-grishaev commented 9 years ago

Do not try to get prototype if we already have descriptor.

domenic commented 9 years ago

Hmm, why does this method even exist? getPropertyDescriptor isn't part of ES6.

maxim-grishaev commented 9 years ago

@domenic well, it was. At the moment I cannot find if it was decided to remove this from specs...

domenic commented 9 years ago

It was never in any spec drafts at all.

maxim-grishaev commented 9 years ago

You think? http://wiki.ecmascript.org/doku.php?id=harmony:extended_object_api

domenic commented 9 years ago

That is not a spec draft. It's a wiki page where committee members write down random ideas they have...

maxim-grishaev commented 9 years ago

Ok, this was proposal. Quite obvious one. And I really dont know why there is no any analog in spec. So maybe the best option is to remove this method from shim completely.

ljharb commented 9 years ago

I like the simplification, but if it's not in the spec, we definitely need to remove it.

What about Object.getPropertyNames which is in the same vein?

domenic commented 9 years ago

Also never in the spec.

bterlson commented 9 years ago

There is "getOwnPropertyDescriptors" which is currently a stage 0 strawman (with a possibility of making it on the ES7 train).

ljharb commented 9 years ago

@KidsKilla Either this PR should be closed, or it should be updated to remove both of these methods, their tests, and their mentions in the README. Thanks!

ljharb commented 9 years ago

I've removed both - thanks for the PR, @KidsKilla, and thanks for catching that this isn't in the spec, @domenic!