-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there an error in the judgment criteria in Object.defineProperty? #2764
Comments
We do not recommend using only |
@JakeChampion Thank you for your suggestion. I actually used only the method I needed to fill in, but in any case, the code I marked in the figure is incorrect. |
Could you please explain what is incorrect, it looks correct to me |
// https://polyfill.io/v3/polyfill.js?flags=always
...
var getterType = 'get' in descriptor && typeof descriptor.get; // getterType can never be undefined
var setterType = 'set' in descriptor && typeof descriptor.set; // setterType can never be undefined
if (getterType) { // This judgment means that the following judgment should not have undefined
if (getterType === undefined) { // getterType can never be undefined, but it may be "undefined"
return object;
}
...
}
if (setterType) {
if (setterType === undefined) {
return object;
}
...
} In the image of my original question, the comments I added in the above code are well explained. |
The request link I am using: https://polyfill.io/v3/polyfill.js?flags=always
Errors during use:
This method is not used in my code, it may be used by other third-party libraries. But it can work normally in modern browsers without introducing
polyfill
.The text was updated successfully, but these errors were encountered: