From f6f4e32485989498e9360dd301fb6ecc023711b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=B7?= Date: Tue, 23 Oct 2018 07:59:51 +0100 Subject: [PATCH] fix: Update getAllPath query selector (#653) Closes https://github.com/docsifyjs/docsify/issues/614 --- src/plugins/search/search.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/search/search.js b/src/plugins/search/search.js index 9d21d8133..7a14ebbce 100644 --- a/src/plugins/search/search.js +++ b/src/plugins/search/search.js @@ -1,5 +1,4 @@ let INDEXS = {} -let helper function escapeHtml(string) { const entityMap = { @@ -17,7 +16,7 @@ function escapeHtml(string) { function getAllPaths(router) { const paths = [] - helper.dom.findAll('a:not([data-nosearch])').forEach(node => { + document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(node => { const href = node.href const originHref = node.getAttribute('href') const path = router.parse(href).path @@ -149,8 +148,6 @@ export function search(query) { } export function init(config, vm) { - helper = Docsify - const isAuto = config.paths === 'auto' const isExpired = localStorage.getItem('docsify.search.expires') < Date.now() @@ -171,7 +168,7 @@ export function init(config, vm) { return count++ } - helper + Docsify .get(vm.router.getFile(path), false, vm.config.requestHeaders) .then(result => { INDEXS[path] = genIndex(path, result, vm.router, config.depth)