[Object.defineProperty] possible to contribute a fix on 3.x series?
See original GitHub issueWhat
The Object.defineProperty
polyfill correctly makes use of the native version when exists, but only on very specific objects. Thus, for random general usage the polyfill blatantly ignores the native Object.defineProperty
. I can’t seem to find a reason to not use the native version always if exists (why limit it to window
, document
, or Element
?).
We find this problem when trying to force-load the bind
polyfill with:
https://polyfill.io/v3/polyfill.js?features=Function.prototype.bind|always
Details
We would need this fixed on the 3.x
line, given that the latest 4.x
line also removes the Function.prototype.bind
which is required for our use case.
I’ve prepared a branch, but I can’t contribute a PR to create a new 3.x
branch in this repository. AFAIK the creation of that new branch would be required to introduce changes based on 3.111.0
:
https://github.com/Financial-Times/polyfill-library/compare/v3.111.0...the-hotels-network:3.x?expand=1
Please let me know if I can help this advance. Thanks a lot @JakeChampion and contributors.
Issue Analytics
- State:
- Created a year ago
- Comments:7
Ouuuuch. Good insight! All finally makes sense, and nothing should be changed on
3.x
then… I definetily need to push thebind
polyfill free of theObject.defineProperty
dep, but It can’t be done with the current polyfill-service. And shouldn’t, since that is a too specific use case. I will have to solve the situation by other means.Thanks a lot for your help @JakeChampion @romainmenke 👏 ❤️
The issue with the native Object.defineProperty is in Internet explorer 8, Object.defineProperty could only work on DOM elements, and not on any type of object.
The feature detection test confirms whether Object.defineProperty can work on any type of object
https://github.com/Financial-Times/polyfill-library/blob/554248173eae7554ef0a7776549d2901f02a7d51/polyfills/Object/defineProperty/detect.js#L1-L11