Re: [whatwg/url] URL.relative proposal (#421)

> or example, a relative URL from https://example.com/full/ to https://example.com/full/path/resource could return a string in the form //example.com/full/path/resource

I'd like to explicitly state that the use case of getting `//example.com/full/path/resource` from `https://example.com/full/path/resource` is out of the concern of the above proposal, and that if you are interested in this to separately propose a `new URL('https://example.com/full/path/resource').schemePath` or whatever it would make sense to call it.

The output of the relative URL function remains completely well-defined. The complexities of relateurl can also be done with URL manipulation before running such a function.

@annevk the common scenario is basically any generation or template creation of HTML / CSS / JS with references to other resources that need to be relative and not encode the base URL as the URL is independent. While in many cases the URL can be assumed to be the same as the page, if the template being generated needs to run on any other base URL, then URL.relative is needed.

-- 
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/421#issuecomment-446209400

Received on Tuesday, 11 December 2018 13:52:56 UTC