Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

@webcomponents/url polyfill is broken for new URL(undefined, "https://example.com") #1039

Closed
JeanRemiDelteil opened this issue Oct 20, 2018 · 5 comments

Comments

@JeanRemiDelteil
Copy link

When using new URL(a, b) with a not being a string, the code will crash, as it uses internally a.replace()

This breaks the code for transpiled es6 to es5 on IE11 (or example with the <iron-image> element).
It's also not in sync with the behaviour of modern browsers where
new URL(undefined, 'https://example.com') == 'https://example.com/undefined'
new URL(null, 'https://example.com') == 'https://example.com/null'

Quick fix would be to use in the polyfill:
(''+a).replace()

@TimvdLippe
Copy link
Contributor

@JeanRemiDelteil That polyfill lives in https://github.com/webcomponents/URL Feel free to open a PR there.

@JeanRemiDelteil
Copy link
Author

@TimvdLippe it's done and awaiting validation :)

webcomponents/URL#32

@TimvdLippe
Copy link
Contributor

PR merged. We just need to publish the polyfill there and then update it here.

@JeanRemiDelteil
Copy link
Author

Awesome ! thanks :)

@TimvdLippe
Copy link
Contributor

Should be fixed in version 0.7.2: webcomponents/URL@d03ece9

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

No branches or pull requests

2 participants