- From: Domenic Denicola <notifications@github.com>
- Date: Tue, 05 May 2020 09:26:35 -0700
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/url/pull/495/review/405949547@github.com>
@domenic commented on this pull request.
This is quite helpful.
I think it'd be worth explicitly noting that using any of the mutating methods (append, delete, set, or sort) will change the URL to contain the `application/x-www-form-urlencoded`-encoded characters. And perhaps including one of the shorter examples of such mutations from #491, such as
```js
const url = new URL('http://httpbin.org/anything?a=b ~');
console.log(url.href); // "http://httpbin.org/anything?a=b%20~"
url.searchParams.sort();
console.log(url.href); // "http://httpbin.org/anything?a=b+%7E"
```
And including one of the reading examples would be good too, such as
```js
const url = new URL('http://httpbin.org/anything?a=~&b=%7E');
console.log(url.search); // "?a=~&b=%7E"
// Both "~"
console.log(url.searchParams.get('a'));
console.log(url.searchParams.get('b'));
```
> @@ -3102,6 +3102,23 @@ let params = new URLSearchParams({key: "730d67"})
params.toString() // "key=730d67"</code></pre>
</div>
+<div class=note>
+ <p>As {{URLSearchParams}} objects use the <a><code>application/x-www-form-urlencoded</code></a>
+ format underneath there are some difference with how it encodes certain code points compared to
+ {{URL/search}}.
and href
--
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/pull/495#pullrequestreview-405949547
Received on Tuesday, 5 May 2020 16:26:48 UTC