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

Fails to parse hostname correctly on Chrome #133

Open
rotu opened this issue Aug 2, 2024 · 2 comments
Open

Fails to parse hostname correctly on Chrome #133

rotu opened this issue Aug 2, 2024 · 2 comments

Comments

@rotu
Copy link

rotu commented Aug 2, 2024

URL parsing relies on the native URL implementation, which is buggy.

So new URLPattern({hostname:'example.com'}).test("foo://example.com") returns false in Chrome when using this polyfill. The root cause seems to be a noncompliant URL implementation: https://issues.chromium.org/issues/40063064

Maybe this should use https://www.npmjs.com/package/whatwg-url instead of the native implementation?

@voxpelli
Copy link

voxpelli commented Aug 3, 2024

I would say, as this is a polyfill this merely intends to add missing API:s, not fixing bugs in existing ones

@rotu
Copy link
Author

rotu commented Aug 3, 2024

I would say, as this is a polyfill this merely intends to add missing API:s, not fixing bugs in existing ones

I agree for the most part.

The URLPattern spec refers to the "result of parsing" a string. That refers to the algorithm in the URL spec, not the URL global.

Indeed, this API should work even if you delete globalThis.URL, which is not the case.

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