urlpattern-polyfill
urlpattern-polyfill copied to clipboard
feat: case-insensitive match for pathname
Related to https://github.com/WICG/urlpattern/issues/148.
This PR adds support for case-insensitive match for pathname. It adds a caseSensitivePath flag to the init object.
Example:
import { strictEqual } from 'assert';
const pattern = new URLPattern({ pathname: '/home', caseSensitivePath: false });
const url = new URL('https://example.com/home');
strictEqual(pattern.test(url.href), true, url.href);
url.pathname = '/HOME';
strictEqual(pattern.test(url.href), true, url.href);
We are matching the spec so maybe file an issue on the spec as well?
We are matching the spec so maybe file an issue on the spec as well?
Thanks! I am continuing the discussion already in the linked issue.
Note, I think we should land WPT changes upstream in chromium or wpt before bringing them here. Chromium will auto-sync to wpt and other browsers, but we don't have that setup for the polyfill repo.
And thanks to @Sayan751 for working on this!
This looks good to me, have the upstream WPT changed landed @wanderview ?
I am fine with landing this and making a new release.
ping @wanderview
No they have not. Sorry, for the delay.
@wanderview so you want me to wait with landing this until that has landed right?
I think that would be best. I'll try to get to the upstream work this week.
Note, I think I'm going to simplify the test changes in my upstream CL. I don't think we need this many test cases for ignoreCase.
The spec changes have landed and I have sent the intent to ship in chrome M107 here:
https://groups.google.com/a/chromium.org/g/blink-dev/c/KgAdo3kB1wc/m/UN70zkeNAwAJ
Note, I recommend using the WPT tests from here instead of the WPT tests currently in this PR:
https://github.com/web-platform-tests/wpt/commit/6d152e4018ca4f45ce93eea4985c516a518c3ad6
Unfortunately I'm not sure how to make this big of a change on someone else's PR.
Hi @Sayan751 do you want to update your PR? Or do you want us to redo it and give you credit?
@kenchris I am sorry for this, but I have no time to update the PR. Please feel free to make the changes as you see fit.
We could just land this and then do a fast follow-up to sync the upstream WPT json file.
Sure. Let's do that.
I will file an issue to track it
OK filed https://github.com/kenchris/urlpattern-polyfill/issues/106