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

@jasnell Yes you can separate the environment from the parsing, alas sadly the 'type' of URL has to be passed as an argument to the parser (e.g. file, web, generic). I have completed the research on that, see e.g. [this][1]. Second, it is immensely useful to be able to abstract the context away, that is one of the main things we do as programmers!

Here is an example. You might have  a web framework (maybe to build a webshop or what have you) that allows for 'plugins'. Such a 'plugin' would consist of a number of endpoints. Now you want to allow 'mounting' multiple instances of that plugin at different paths. The plugin's endpoints would be specified as relative URLs. The 'mount' operation instantiates the plugin and resolves the relative references. In other words, the plugin is parameterised by a base URL and the mount operation resolves them. That is immensely useful. 

[1]: https://github.com/alwinb/spec-url

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/531#issuecomment-837354859

Received on Monday, 10 May 2021 21:16:05 UTC