-
Notifications
You must be signed in to change notification settings - Fork 952
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
Replace qs with URLSearchParams #5592
Conversation
var href = link.href.split(/[?#]/)[0], | ||
args = Qs.parse(link.search.substring(1)), | ||
editlink = $(link).hasClass("editlink"); | ||
let href = link.href.split(/[?#]/)[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is a good and correct change:
let href = link.href.split(/[?#]/)[0]; | |
let href = link.protocol + '//' + link.hostname + link.pathname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not actually changing that line though? Other than replacing var
with let
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the general goal was to replace complex code with modern APIs.
If this is an external library or own code is for me not important.
Both approaches (doing one single task vs bigger refactorings) have pros and cons.
f288601
to
05c1f53
Compare
@@ -39,7 +37,7 @@ OSM.initializeContextMenu = function (map) { | |||
callback: function describeLocation(e) { | |||
const [lat, lon] = OSM.cropLocation(e.latlng, map.getZoom()).map(encodeURIComponent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encodeURIComponent
here probably doesn't do anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, but it's not something new in this pull request?
05c1f53
to
46cd3a1
Compare
the current version of iD (v2.31, before the fix for https://github.com/openstreetmap/iD/issue/10761: openstreetmap/iD#10766), does not fully support `x-www-form-urlencoded` "query-style" strings in the hash: Specifically, spaces encoded as `+` will not be decoded back to ` `. This workaround essentially temporarily reverts the behaviour of the website to the state before openstreetmap#5592, and can be dropped again with the next minor version upgrade of iD (`v2.32`).
As javascript now has a builtin way to parse URL search parameters we don't really need the qs module any more, so replace it with the builtin support.