-
Notifications
You must be signed in to change notification settings - Fork 141
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
relative URLs #136
Comments
The key challenge with relative URLs is that the rules for handling them can vary significant based on what they are relative to. For instance |
Interesting. Something for me to think about. |
I think it's fine, actually, that we don't parse relative URLs. The only downside is backwards-compatibility with Node's |
OK. One thing to keep in mind is that we are currently looking at adding On Saturday, August 6, 2016, Steven Vachon notifications@github.com wrote:
|
Awesome! I didn't know that. |
Yeah, the main reason relative URLs cannot be turned into an object, is because it makes little sense to do so without a base URL. I still think that design makes sense. Given your comment above I'm going to close this. Hope that's okay. |
I'd like to push for some notion of a "relative URL" as a first-class object, at least in the spec terminology if not in the API. I'm working on defining a file format that includes a construct for referring to documents from other documents, naturally using URLs. The thing is, I want to define some behavior around this construct that's independent of the base URL, but still uses URL notions like the path. The spec as it stands provides me no way of saying "this is a relative URL, and the path must contain at least one element that's an identifier" or whatever. To put this more generally: tools often process documents at build time, in a context-free manner, where the base URL is not known. They may even process documents that may be used in multiple contexts with different base URLs. I believe this is why humans tend to gravitate towards referring to "relative URLs" as objects in and of themselves, and there's value in the spec matching this intuition in some way. Right now, it provides no way to even talk about a URL unless you have all the context of how the document that contains it will be used. One possibility would be for the spec to include a definition of "relative URL" that explicitly includes an initial "ambiguous segment" and forbids certain operations if that segment is non-empty. |
@nex3 it might be good to open a new issue as discussions in closed issues tend to get lost or forgotten about. Having said that, does https://url.spec.whatwg.org/#relative-url-with-fragment-string not help here somewhat? It seems the URL Standard does offer you to place restrictions on what can be produced. And since the parser only takes a string, it would only makes sense to have objects here if we also did something with them, I think. |
Now that a native URL parser is finally being standardized and implemented, why would we leave out relative URLs? They are URLs:
Due to the decisions made, another parser will be necessary -- that is silly.
The text was updated successfully, but these errors were encountered: