Re: [whatwg/url] URL serialiser does not produce idempotent strings if an opaque path has a trailing space and "exclude fragment" is true (Issue #784)

Thanks! I didn't notice that idempotence is clearly stated as a goal in the URL Standard. I understand now.

> 1. Always replace a trailing space in an opaque path with %20.

Proposal 1 means:

```
const url = new URL("data:blah  #a");
assertEquals(url.pathname, "blah %20");
url.hash = "";
assertEquals(url.pathname, "blah %20");
```

, right? This sounds best to me (out of 1/2/3/1b/2b/3b).

However, as far as I understand, the following URLs (as a result of serialization) are not [equivalent](https://url.spec.whatwg.org/#url-equivalence) to each other:


- "data:blah  "
- "data:blah%20%20"
- "data:blah %20"

So every option proposed here seems a technically breaking change.

> 3. We always trim trailing spaces from opaque paths. Technically a breaking change, but overall it's better at ensuring everything stays consistent.

This doesn't seem a popular option here, however, this looks the simplest and easy-to-understand rule to me.

I assume we introduce a breaking change anyway.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/784#issuecomment-1730732590
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/issues/784/1730732590@github.com>

Received on Friday, 22 September 2023 02:52:39 UTC