Skip to content
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

Don't use IE11's native getOwnPropertyDescriptor on objects like window.location #601

Closed
Hypnosphi opened this issue Jul 18, 2019 · 3 comments

Comments

@Hypnosphi
Copy link

It throws "Object doesn't support this action" error

See babel/babel#10233 for context

@Hypnosphi Hypnosphi changed the title Don't try to use IE11's native getOwnPropertyDescriptor on objects like window.location Don't use IE11's native getOwnPropertyDescriptor on objects like window.location Jul 18, 2019
@zloirock
Copy link
Owner

zloirock commented Jul 24, 2019

It's not an issue of core-js. In your example, babel helpers use Object.getOwnPropertyDescriptor on window.location. They call core-js wrapper of Object.getOwnPropertyDescriptor, but it's just a wrapper - you will have the same issue in IE11 even without core-js. IE11 Object.getOwnPropertyDescriptor can't work with environment exotic objects like window.location and, in the scope of core-js, we can't add special cases for all possible environment exotic objects.

Since it's not a core-js issue, I'll reopen the issue in the babel repo, but I don't think that it's something that should be solved on babel helpers side.

If you wanna just copy a URL, you could use just const locationCopy = new URL(window.location).

@Hypnosphi
Copy link
Author

If you wanna just copy a URL, you could use just const locationCopy = new URL(window.location)

No, I'm actually extending the object: {...window.location, ...somethingElse}

@zloirock
Copy link
Owner

@Hypnosphi you could extend a copied location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants