From 33c8c4a769363e6dd49a0059c92a9b424aa7e0ff Mon Sep 17 00:00:00 2001 From: sy-records <52o@qq52o.cn> Date: Mon, 8 Mar 2021 18:38:54 +0800 Subject: [PATCH 1/2] fix: Cannot read property 'classList' of null --- src/plugins/search/component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/search/component.js b/src/plugins/search/component.js index 388de395d..8ec50a15e 100644 --- a/src/plugins/search/component.js +++ b/src/plugins/search/component.js @@ -137,8 +137,8 @@ function doSearch(value) { $panel.innerHTML = ''; if (options.hideOtherSidebarContent) { - $sidebarNav.classList.remove('hide'); - $appName.classList.remove('hide'); + $sidebarNav && $sidebarNav.classList.remove('hide'); + $appName && $appName.classList.remove('hide'); } return; From 2744b910080f117ac13c9fc5653da7c3865c6886 Mon Sep 17 00:00:00 2001 From: sy-records <52o@qq52o.cn> Date: Tue, 9 Mar 2021 14:38:23 +0800 Subject: [PATCH 2/2] fix: Cannot read property classList of null https://github.com/docsifyjs/docsify/pull/1527#issuecomment-793455105 --- src/plugins/search/component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/search/component.js b/src/plugins/search/component.js index 8ec50a15e..06a698e17 100644 --- a/src/plugins/search/component.js +++ b/src/plugins/search/component.js @@ -160,8 +160,8 @@ function doSearch(value) { $clearBtn.classList.add('show'); $panel.innerHTML = html || `

${NO_DATA_TEXT}

`; if (options.hideOtherSidebarContent) { - $sidebarNav.classList.add('hide'); - $appName.classList.add('hide'); + $sidebarNav && $sidebarNav.classList.add('hide'); + $appName && $appName.classList.add('hide'); } }