Re: [whatwg/url] can't parse urls starting with xn-- (#438)

Digging a bit further, and another cornercase that seems related to this is that `host` setter doesn't throw when set to an invalid value:
```js
const x = new URL('http://example.com');
x.host = 'xn--a';
console.log(x.href);
// node: http://example.com/
// browser: http://xn--a/
```
While
```js
const x = new URL('http://example.com');
x.href = 'http://xn--a/';
console.log(x.href);
// node: throws "Invalid URL: http://xn--a/"
// browser: http://xn--a/
```
Wouldn't it make sense to make all setters throw when it results in an invalid `URL`, not only the `href` setter. According to the spec, this behavior is only specified for the `href` setter. (Maybe this should be a separate issue?)

-- 
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/438#issuecomment-488671158

Received on Thursday, 2 May 2019 13:24:14 UTC