From 4db8cd6abf9f0bcf43a9ad599058a40c303527da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=B7?= Date: Mon, 12 Nov 2018 02:22:14 +0000 Subject: [PATCH] fix: IE10 compatibility (#691) * fix: IE10 compatibility * chore: use built-in helper fn --- src/core/render/compiler.js | 2 +- src/plugins/search/search.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/render/compiler.js b/src/core/render/compiler.js index 34c64ae72..e1cd9bf4c 100644 --- a/src/core/render/compiler.js +++ b/src/core/render/compiler.js @@ -241,7 +241,7 @@ export class Compiler { } href = router.toURL(href, null, router.getCurrentPath()) } else { - attrs += href.startsWith('mailto:') ? '' : ` target="${linkTarget}"` + attrs += href.indexOf('mailto:') === 0 ? '' : ` target="${linkTarget}"` } if (config.target) { diff --git a/src/plugins/search/search.js b/src/plugins/search/search.js index 7a14ebbce..1f246ed36 100644 --- a/src/plugins/search/search.js +++ b/src/plugins/search/search.js @@ -16,7 +16,7 @@ function escapeHtml(string) { function getAllPaths(router) { const paths = [] - document.querySelectorAll('.sidebar-nav a:not(.section-link):not([data-nosearch])').forEach(node => { + Docsify.dom.findAll('.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