Skip to content
Snippets Groups Projects
Commit fd2c3c77 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2099599 by jantimon: Minor for-loop optimizations for base.js.

parent 44fb4177
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -17,14 +17,13 @@ ...@@ -17,14 +17,13 @@
if (pos !== -1) { if (pos !== -1) {
query = query.substring(pos + 1); query = query.substring(pos + 1);
} }
var pair;
var pairs = query.split('&'); var pairs = query.split('&');
for(var i in pairs) { for (var i = 0; i < pairs.length; i++) {
if (typeof(pairs[i]) === 'string') { pair = pairs[i].split('=');
var pair = pairs[i].split('='); // Ignore the 'q' path argument, if present.
// Ignore the 'q' path argument, if present. if (pair[0] !== 'q' && pair[1]) {
if (pair[0] !== 'q' && pair[1]) { args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' '));
args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' '));
}
} }
} }
return args; return args;
...@@ -69,7 +68,7 @@ ...@@ -69,7 +68,7 @@
href = href.substring(3, href.length); href = href.substring(3, href.length);
} }
var chars = ['#', '?', '&']; var chars = ['#', '?', '&'];
for (var i in chars) { for (var i = 0; i < chars.length; i++) {
if (href.indexOf(chars[i]) > -1) { if (href.indexOf(chars[i]) > -1) {
href = href.substr(0, href.indexOf(chars[i])); href = href.substr(0, href.indexOf(chars[i]));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment