Re: [whatwg/url] Support relative URLs (#531)

I wanted to note that Alwin Blok’s implementation is fairly concrete and does pass most (if not all) of the WPT tests. I feel like the spec is really cleanly written, and in my opinion is much clearer to follow than the WHATWG spec. (Now, this is not to dissmiss the WHATWG’s spec and their efforts, but I feel like the way Alwin’s spec is laid out makes it much easier to follow for me.)

I do not want to get into reasons as to why trying to at least formally explain discrepancies between the WHATWG spec and the RFCs might be useful, as that is off‐topic for this issue (though I believe there are at least some).

Now, I will note: I do understand that it might be the case that relative URLs are not practically useful. To be honest, I don’t know for sure either way. I feel like that there at least should be an API to convert a URL record into a relative URL string.

From what I can see, people want to manipulate URLs in the back‐end (and sometimes in the front‐end too) in a way that allows for them to produce a relative URL string. So that e.g. they could change something like `<img src="flower.png">` into `<img src="/assets/flower.png">` by resolving `"flower.png"` against `"/assets/"`.

Perhaps a more narrowed‐scope API could be to allow people to relativize a URL based on a URL component name. So that e.g. for `url = new URL("https://example.org/hello?world#test")`, then `url.relativize("path")` would effectively strip away everything before the path and return `"/hello?world#test"`, likewise for e.g. `url.relativize("query") === "?world#test"`.

(On an unrelated note: I feel like y’all are just being dismissive of each other’s efforts and interest in helping out, and I feel like that is really counter‐productive. If you truly have the intention of helping, I feel like you should be encouraging each other to **both** pursue investigations and researching new approaches **as well as** focusing on the current WHATWG spec and fixing the issues within it by actively trying to gather concrete use‐cases.)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/531#issuecomment-1034145033

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/issues/531/1034145033@github.com>

Received on Wednesday, 9 February 2022 20:04:30 UTC