Re: [whatwg/url] Good defaults on URL() (#71)

As I said up above, passing relative urls is *fraught*.  A relative url in `<a href>` refers to a *completely different file* than one in `background-image: url()`, so you *almost never* actually want to hold and pass around relative urls.  Even within "just a JS script", there are multiple reasonable answers for what base URL it should use - the current location (what the user sees in the address bar), the base url (what `<a href>` resolves against, affected by `<base>`), the origin (in case the specific page address isn't important or unavailable, like in a Service Worker), etc.

This is why I suggested a mixin for anything that provides a useful "base url" concept, that just takes a relative url and absolutizes it for you "in the obvious way" for that thing, so you don't have to hunt down what the base url is for a given context.

---
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/71#issuecomment-204068843

Received on Thursday, 31 March 2016 18:36:24 UTC