Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enumerate differences between URLSearchParams and search #495

Merged
merged 3 commits into from
May 6, 2020

Conversation

annevk
Copy link
Member

@annevk annevk commented May 5, 2020

Closes #18. Follow-up: #491.

I should probably add some editor warnings in case we ever change one of these four enumerations.


Preview | Diff

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'));

url.bs Outdated Show resolved Hide resolved
@annevk annevk requested a review from domenic May 6, 2020 10:20
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@annevk annevk merged commit 8315a80 into master May 6, 2020
@annevk annevk deleted the annevk/params-vs-query branch May 6, 2020 15:40
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Investigate aligning application/x-www-form-urlencoded with URL's query
2 participants