fix(post/toc): js toc error (#271)

Closes #279
This commit is contained in:
yhliyr 2020-09-11 00:08:59 +08:00 committed by GitHub
parent 7dfedd3440
commit 708de67fd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,7 +113,7 @@ Even._initToc = function() {
$($toclink).removeClass('active');
$($tocLinkLis).removeClass('has-active');
if (activeTocIndex !== -1) {
if (activeTocIndex !== -1 && $toclink[activeTocIndex] != null) {
$($toclink[activeTocIndex]).addClass('active');
let ancestor = $toclink[activeTocIndex].parentNode;
while (ancestor.tagName !== 'NAV') {