[whatwg/url] Setters can cause failure to roundtrip (#651)

Generally, we assume setters will keep the URL valid and roundtrippable. However, this turns out not to be true in a specific case:

```js
u = new URL('data:text/html,hello #hash');
u.hash = '';
console.log(JSON.stringify(u.href)); // "data:text/html,hello "

u2 = new URL(u); // constructor strips leading/trailing spaces as a first step
console.log(JSON.stringify(u2.href)); // "data:text/html,hello" without the trailing space
```

This is only an issue because we allow spaces to appear verbatim in cannot-be-a-base URL paths.

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

Received on Friday, 24 September 2021 23:46:42 UTC