Commit fd2c3c77 authored by webchick's avatar webchick

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

parent 44fb4177
......@@ -17,14 +17,13 @@
if (pos !== -1) {
query = query.substring(pos + 1);
}
var pair;
var pairs = query.split('&');
for(var i in pairs) {
if (typeof(pairs[i]) === 'string') {
var pair = pairs[i].split('=');
// Ignore the 'q' path argument, if present.
if (pair[0] !== 'q' && pair[1]) {
args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' '));
}
for (var i = 0; i < pairs.length; i++) {
pair = pairs[i].split('=');
// Ignore the 'q' path argument, if present.
if (pair[0] !== 'q' && pair[1]) {
args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' '));
}
}
return args;
......@@ -69,7 +68,7 @@
href = href.substring(3, href.length);
}
var chars = ['#', '?', '&'];
for (var i in chars) {
for (var i = 0; i < chars.length; i++) {
if (href.indexOf(chars[i]) > -1) {
href = href.substr(0, href.indexOf(chars[i]));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment