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

The `new URL()` constructor currently requires an absolute URL as input, or an absolute base URL, which is painful when there is no obvious base URL to use, such as in the context of a command line app or other non-browser environment.

In many cases, it's useful to parse and resolve relative URLs, such as URL paths or origin-relative URLs, without an absolute base URL.

```js
new URL('/to', '/from');
new URL('/to', '//from.com/');
```

The lack of support for this use case is causing me to remove WHATWG URL from Ky, a popular HTTP request library, in favor of our own string replacement. See: https://github.com/sindresorhus/ky/pull/271


-- 
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

Received on Friday, 17 July 2020 03:36:01 UTC