Enumerate differences between URLSearchParams and search#495
Merged
Conversation
domenic
reviewed
May 5, 2020
Member
domenic
left a comment
There was a problem hiding this comment.
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
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
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'));
domenic
approved these changes
May 6, 2020
Member
domenic
left a comment
There was a problem hiding this comment.
LGTM. We should update our stylesheet to not italicize pre blocks inside of notes, I think.
annevk
added a commit
to whatwg/whatwg.org
that referenced
this pull request
May 6, 2020
This avoids a .note italicizing it: whatwg/url#495.
domenic
pushed a commit
to whatwg/whatwg.org
that referenced
this pull request
May 6, 2020
This avoids a .note italicizing it: whatwg/url#495.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18. Follow-up: #491.
I should probably add some editor warnings in case we ever change one of these four enumerations.
Preview | Diff