Current item may be undefined
Worked fine before, but better safe than sorry.
This commit is contained in:
@@ -71,10 +71,12 @@ $(function () {
|
|||||||
.replace(/_/g, '/')
|
.replace(/_/g, '/')
|
||||||
.replace(/-/g, '~');
|
.replace(/-/g, '~');
|
||||||
const currentItem = navListNode.querySelector('.item[data-longname="' + longname + '"]');
|
const currentItem = navListNode.querySelector('.item[data-longname="' + longname + '"]');
|
||||||
$navList.prepend(currentItem);
|
if (currentItem) {
|
||||||
|
$navList.prepend(currentItem);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
$navList: $navList,
|
$navList: $navList,
|
||||||
$currentItem: $(currentItem),
|
$currentItem: currentItem ? $(currentItem) : undefined,
|
||||||
lastSearchTerm: undefined,
|
lastSearchTerm: undefined,
|
||||||
lastState: {},
|
lastState: {},
|
||||||
getClassList: function () {
|
getClassList: function () {
|
||||||
@@ -138,7 +140,7 @@ $(function () {
|
|||||||
// Restore the original, sorted order
|
// Restore the original, sorted order
|
||||||
search.$navList.append(search.getClassList());
|
search.$navList.append(search.getClassList());
|
||||||
}
|
}
|
||||||
if (state === 'search-empty') {
|
if (state === 'search-empty' && search.$currentItem) {
|
||||||
search.manualToggle(search.$currentItem, true);
|
search.manualToggle(search.$currentItem, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user