-
Notifications
You must be signed in to change notification settings - Fork 139
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
Inconsistency when using URLSearchParams to mutate a URL #478
Comments
I could work on the proposed spec text here but want to confirm the approach before doing so. What I'd propose for this is that the URL rules be applied when the URLSearchParams associated with a URL ( |
And as far as implementor interest, I would definitely update Node.js behavior to support the new approach. |
@bakulf @achristensen07 to determine interest from Gecko and WebKit. @domenic do you know who to ask for Chromium? |
Maybe @ricea... |
Given that all implementations agree on implementation, we seem to already have achieved the goal of uniformity. |
My take on the history (from #18) is that It was designed as a kind of And then things got worse when one got attached to every So although we have cross-browser uniformity, we unfortunately have a massive web developer footgun. There are a few ways out of this:
I have always favored (3), but been unsure if we could get away with it; there are compat risks. The proposal of (2) is novel, but I'm not sure if it's a great idea; it seems like it'd add confusion and I don't know how much compat risk it would really mitigate. (5) would be a great unification and simplification for the platform, but even more risky than (3). Sadly, I think (1) or (4) are the most realistic. |
I think one aspect that's missing is that |
I would just introduce a new object and rename Solution no 4 would work too. IMO it's more likely to see this than point 3. I'd name it 5 is very unlikely to happen. But that's the solution everybody wants to see I guess. |
Of the 5, I may be biased since it's my proposal but, ignoring option 1, option 2 has the least likely chance of being breaking (or at least disruptive). Option 3 may have been the better choice if we were starting from scratch but at this point I don't believe it's worth potentially breaking anything with the change in semantics and introducing entirely new API artifacts just does not seem justified. 4 is an Ok option but we'd likely end up implementing it in much the same way we'd implement 2 -- that is, this |
I am in favour of maintaining the status-quo. Changing the standard to a different behaviour when the browsers are already aligned is risky and I think there has to be compelling benefits to justify it. I don't think this meets the bar. |
I would be in favor of not changing the status quo here. |
Based on the responses I don't think we're going to get changes here, which is understandable. We'll add a clarification to the Node.js docs so folks can be informed on the differences and go from there. Thanks all! |
I'll resolve #18 with some kind of documentation in the URL Standard itself about this. |
I'd like to leave #18 open to explore alternative (4), since it sounds like implementers are not willing to do any of the others. |
I think that's best done as a new issue, if there's indeed interest in that. I'm not really convinced that's worth doing. |
Can we reopen this issue please? No 4 seems to be the way to go. We can easily add a new feature now and when it gets popular enough, we can just deprecate the |
I think it's underselling it to state that we can "easily" add a new feature in this way. But, I opened #491 to track (4), as requested. |
See: nodejs/node#33037
Relates to: #18
Because of the differences in
URLSearchParams
and.search
stringification, encoding of the tilde (~
) character becomes inconsistent when usingURLSearchParam
to mutate aURL
instance... take the following examples for instance:And...
(demonstrated in Node.js, but appears consistent across implementations)
Per #18, there are reasons why
URLSearchParam
uses different semantics for stringification, and I don't necessarily want to revisit those, but we should likely give consideration to what the expected behavior should be whenURLSearchParam
is used to mutate aURL
instance. Which of the differing encoding semantics should take precedence?/cc @szmarczak @bnoordhuis @himself65 @Hamper
The text was updated successfully, but these errors were encountered: