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

Editorial: fold cannot-be-base-URL into path #655

Merged
merged 5 commits into from
Oct 19, 2021

Conversation

annevk
Copy link
Member

@annevk annevk commented Oct 7, 2021

Fetch PR: whatwg/fetch#1337.

HTML PR: whatwg/html#7240.

URLPattern PR: whatwg/urlpattern#143.

Fixes #634.


Preview | Diff

@wanderview
Copy link
Member

I think URLPattern would also need to be updated after this change.

@annevk
Copy link
Member Author

annevk commented Oct 7, 2021

Thanks Ben! This took a bit more effort than expected, but I think it does look rather nice and having the URL path serializer will also allow for some nice cleanup elsewhere, in particular in HTML. This will need to be validated in jsdom's whatwg-url (ideally by someone that's not me) and I'd like @karwa @TimothyGu @alwinb @domenic to be okay with it.

I'm not a big fan of "string path state". I considered renaming path in the other path-related states to hierarchical path, but I think it would be confusing if the lone path state ended up being the exceptional case.

Copy link
Member

@TimothyGu TimothyGu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this cleanup! It would also match how Go's net/url package stores paths better, and convergence is always nice.

url.bs Outdated Show resolved Hide resolved
url.bs Outdated Show resolved Hide resolved
url.bs Show resolved Hide resolved
Copy link
Contributor

@alwinb alwinb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this a lot, much better!

url.bs Outdated Show resolved Hide resolved
url.bs Outdated Show resolved Hide resolved
url.bs Outdated Show resolved Hide resolved
@annevk
Copy link
Member Author

annevk commented Oct 18, 2021

I addressed the review comments. This made me think "hierarchical path" was no longer pulling its weight. I hope that's still agreeable. We could always add it back at some future point once there is a more compelling need.

I'll see how easy it is to update whatwg-url these days. Edit: it was straightforward and the tests are passing.

url.bs Outdated Show resolved Hide resolved
@alwinb
Copy link
Contributor

alwinb commented Oct 18, 2021

I just spotted that the id attribute on the opaque path state is unchanged as "cannot-be-a-base-url-path-state". I don't know if that is intentional.

@annevk
Copy link
Member Author

annevk commented Oct 19, 2021

Yeah that is intentional. I prefer keeping old IDs around so old links keep working. I also like that it shows the document has some history. We can of course add a new ID as well, but it's not always clear to me that is worth the additional bytes and nodes.

annevk added a commit to web-platform-tests/wpt that referenced this pull request Oct 19, 2021
annevk added a commit to whatwg/fetch that referenced this pull request Oct 19, 2021
These URLs now have a path whose value is a string rather than a list.

See whatwg/url#655 for context.
annevk added a commit to whatwg/html that referenced this pull request Oct 19, 2021
These URLs now have a path whose value is a string rather than a list.

See whatwg/url#655 for context.
annevk added a commit that referenced this pull request Oct 19, 2021
This helps whatwg/urlpattern#141. #655 will export the remaining state.
@annevk annevk merged commit fbaa03c into main Oct 19, 2021
@annevk annevk deleted the annevk/partially-hierarchical branch October 19, 2021 10:32
annevk added a commit that referenced this pull request Oct 19, 2021
This helps whatwg/urlpattern#141. #655 exported the remaining state.
annevk added a commit to whatwg/fetch that referenced this pull request Oct 19, 2021
These URLs now have a path whose value is a string rather than a list.

See whatwg/url#655 for context.
annevk added a commit to whatwg/html that referenced this pull request Oct 19, 2021
These URLs now have a path whose value is a string rather than a list.

See whatwg/url#655 for context.
domenic pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 19, 2021
domenic pushed a commit to jsdom/whatwg-url that referenced this pull request Oct 19, 2021
@karwa
Copy link
Contributor

karwa commented Oct 25, 2021

(Apologies for not responding sooner; I've been away. I didn't expect all this activity! 😅)

Thank you so much @annevk! This is really fantastic; it seems to have involved coordinating a lot of updates to other standards, which can't have been easy, but I think it makes this standard significantly better.

The motivation for #634 was so I could explain to users of my URL library which operations may fail and why, without inventing my own terminology that they can't search for on the web. This helps make a lot of the limitations around URLs with opaque paths much less... well, opaque:

  • Why can't I split this URL's path in to components? Because it's an opaque string, not a list.
  • Why can't I set a hostname on this URL? Because it would be separated from the path with a "/", turning the path in to a list.
  • Why can't I resolve a relative reference against this URL? Because its path is opaque; we can't split it up to add/remove components.

Which is a lot better than saying "because the parser decided to set some flag which forbids it". So I definitely appreciate it, and I'm sure my users will also very much appreciate it.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Oct 29, 2021
Automatic update from web-platform-tests
URL: test origin of blob: URLs

For whatwg/url#655.
--

wpt-commits: 5acc42721ce5811462acc297bff75d33f999cd8f
wpt-pr: 31305
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Nov 1, 2021
Automatic update from web-platform-tests
URL: test origin of blob: URLs

For whatwg/url#655.
--

wpt-commits: 5acc42721ce5811462acc297bff75d33f999cd8f
wpt-pr: 31305
Gabisampaio pushed a commit to Gabisampaio/wpt that referenced this pull request Nov 18, 2021
wanderview added a commit to whatwg/urlpattern that referenced this pull request Nov 22, 2021
* Editorial: align with URL's cannot-be-base-URL removal

These URLs now have a path whose value is a string rather than a list.

See whatwg/url#655 for context.

* Apply suggestions from code review

Co-authored-by: Anne van Kesteren <annevk@annevk.nl>

Co-authored-by: Ben Kelly <ben@wanderview.com>
dandclark pushed a commit to dandclark/html that referenced this pull request Dec 4, 2021
These URLs now have a path whose value is a string rather than a list.

See whatwg/url#655 for context.
ericorth pushed a commit to ericorth/fetch that referenced this pull request Feb 18, 2022
These URLs now have a path whose value is a string rather than a list.

See whatwg/url#655 for context.
mfreed7 pushed a commit to mfreed7/html that referenced this pull request Jun 3, 2022
These URLs now have a path whose value is a string rather than a list.

See whatwg/url#655 for context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Editorial] Replace the term 'cannot-be-a-base' with hierarchical/non-hierarchical
6 participants