-
Notifications
You must be signed in to change notification settings - Fork 784
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
fix: polyfill Object.hasOwn for node 14 #4152
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking on fixing < node 14.
It looks like core-js provides an implementation for Object.hasOwn, which we already depend on. We should use that one rather than bring in another dependency.
Also, the way we handle doing these types of polyfills in axe-core is to add them to the imports file and only apply the polyfill if the current implementation does not exist. That way we don't have to rewrite every use of the function and can easily remove it when we don't need the polyfill anymore.
import hasOwn from 'core-js-pure/actual/object/has-own';
if (!('hasOwn' in Object) {
Object.hasOwn = hasOwn;
}
Sounds good, done. It seems like tests aren't running in every supported version of node, which would have caught this as well as #4127. I'm not familiar enough with circle to fix that myself, but it'd be great if someone was able to do that separately :-) |
Yep, was actually looking into that myself to see what it would entail. |
Approved for security |
Thanks! I ran |
Hopefully this will make it into v4.8.2? |
Yep, I forgot I wanted this into the 4.8.1 release before we made it. |
@ljharb we released this as part of axe-core v4.8.2 |
Thank you! |
From #4060; fixes jsx-eslint/eslint-plugin-jsx-a11y#953.