- From: Daijirō Wachi <notifications@github.com>
- Date: Sat, 25 Feb 2017 06:42:11 -0800
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 25 February 2017 14:42:46 UTC
The basis why this behavior should avoid is that it allows having an invalid URL in the `href`:
```js
var url = new URL('http://user:pass@foo.bar.com:21/aaa/zzz?l=24#test');
url.protocol = 'file:';
var url2 = new URL(url.href);
// => Uncaught TypeError: Failed to construct 'URL': Invalid URL
//      at <anonymous>:1:1
//  (anonymous) @ VM326:1
```
As another workaround, it can escape the invalid character strings, but it's more predictable and natural to delete automatically imho because the properties such as `username/password/port` are independent of each other.
-- 
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/259#issuecomment-282488110
Received on Saturday, 25 February 2017 14:42:46 UTC