From 48db5f1b8b467b2e1f6a43988c4853025f71bd40 Mon Sep 17 00:00:00 2001 From: Johan Preynat Date: Sat, 4 Jun 2016 15:42:31 +0200 Subject: [PATCH] Fix detecting chapters when summary item doesn't contain a link --- src/js/theme/navigation.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/js/theme/navigation.js b/src/js/theme/navigation.js index a16d199..b698c4c 100644 --- a/src/js/theme/navigation.js +++ b/src/js/theme/navigation.js @@ -289,7 +289,15 @@ function preparePage(resetScroll) { $chapters = $('.book-summary .summary .chapter') .filter(function() { var $link = $(this).children('a'), - href = $link.attr('href').split('#')[0]; + href = null; + + // Chapter doesn't have a link + if (!$link.length) { + return false; + } + else { + href = $link.attr('href').split('#')[0]; + } var resolvedRef = url.resolve(window.location.pathname, href); return window.location.pathname == resolvedRef; -- GitLab