Parse query string in using URLSearchParams

- I just noticed in reading the code that we parse that stuff when something exists in the web api;
 - see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/URLSearchParams.
This commit is contained in:
Calixte Denizet 2021-11-13 17:36:57 +01:00
parent 85c6dd59ce
commit fe95e100e4
3 changed files with 6 additions and 18 deletions

View file

@ -187,11 +187,8 @@ function watchScroll(viewAreaElement, callback) {
*/
function parseQueryString(query) {
const params = new Map();
for (const part of query.split("&")) {
const param = part.split("="),
key = param[0].toLowerCase(),
value = param.length > 1 ? param[1] : "";
params.set(decodeURIComponent(key), decodeURIComponent(value));
for (const [key, value] of new URLSearchParams(query)) {
params.set(key.toLowerCase(), value);
}
return params;
}