From 0425a254e31f01ac9ae6f149d2ae9e7482d67e77 Mon Sep 17 00:00:00 2001 From: "wcoder.com" <350840291@qq.com> Date: Fri, 10 Jan 2020 11:07:39 +0800 Subject: [PATCH] Update navigation.js Uncaught TypeError: Cannot read property 'split' of undefined --- src/js/theme/navigation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/theme/navigation.js b/src/js/theme/navigation.js index dd64d8b5..05312570 100644 --- a/src/js/theme/navigation.js +++ b/src/js/theme/navigation.js @@ -167,7 +167,7 @@ function setChapterActive($chapter, hash) { // Return the hash of link for a chapter function getChapterHash($chapter) { var $link = $chapter.children('a'), - hash = $link.attr('href').split('#')[1]; + hash = ($link.attr('href')||"").split('#')[1]; if (hash) hash = '#'+hash; return (!!hash)? hash : ''; @@ -380,7 +380,7 @@ function preparePage(resetScroll) { return false; } else { - href = $link.attr('href').split('#')[0]; + href = ($link.attr('href')||"").split('#')[0]; } var resolvedRef = url.resolve(window.location.pathname, href);