Skip to content

Commit 9e028ec

Browse files
committed
refactor(defaultTheme): refine focusChildOnNavUp()
1 parent f848f97 commit 9e028ec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/tpl/defaultTheme/frontend/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
var sepIndex = url.indexOf('?');
182182
if (sepIndex < 0) sepIndex = url.indexOf('#');
183183
if (sepIndex >= 0) {
184-
url = url.substring(0, sepIndex);
184+
url = url.slice(0, sepIndex);
185185
}
186186
return url;
187187
}
@@ -193,16 +193,16 @@
193193
var currUrl = extractCleanUrl(location.href);
194194

195195
if (prevUrl.length <= currUrl.length) return;
196-
if (prevUrl.substring(0, currUrl.length) !== currUrl) return;
197-
var goesUp = prevUrl.substring(currUrl.length);
196+
if (prevUrl.slice(0, currUrl.length) !== currUrl) return;
197+
var goesUp = prevUrl.slice(currUrl.length);
198198
if (currUrl[currUrl.length - 1] !== '/' && goesUp[0] !== '/') return;
199199
var matchInfo = /[^/]+/.exec(goesUp);
200200
if (!matchInfo) return;
201201
var prevChildName = matchInfo[0];
202202
if (!prevChildName) return;
203203
prevChildName = decodeURIComponent(prevChildName);
204204

205-
var items = document.body.querySelectorAll(selectorItem);
205+
var items = document.body.querySelectorAll(selectorItemNotNone);
206206
items = Array.prototype.slice.call(items);
207207
var selectorName = '.field.name';
208208
var selectorLink = 'a';
@@ -212,7 +212,7 @@
212212
if (!elName) continue;
213213
var text = elName.textContent;
214214
if (text[text.length - 1] === '/') {
215-
text = text.substring(0, text.length - 1);
215+
text = text.slice(0, -1);
216216
}
217217
if (text !== prevChildName) continue;
218218
var elLink = item.querySelector(selectorLink);

0 commit comments

Comments
 (0)