Skip to content

Commit b4d9c31

Browse files
committed
fix: Use legacy-compatible methods for IE11
1 parent 14ce7f3 commit b4d9c31

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

src/core/fetch/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function fetchMixin(proto) {
7373
case 'object':
7474
key = Object.keys(notFoundPage)
7575
.sort((a, b) => b.length - a.length)
76-
.find(k => path.match(new RegExp('^' + k)));
76+
.filter(k => path.match(new RegExp('^' + k)))[0];
7777

7878
path404 = (key && notFoundPage[key]) || defaultPath;
7979
break;

src/core/render/compiler/link.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const linkCompiler = ({
2929

3030
href = router.toURL(href, null, router.getCurrentPath());
3131
} else {
32-
if (!isAbsolutePath(href) && href.startsWith('./')) {
32+
if (!isAbsolutePath(href) && href.slice(0, 2) === './') {
3333
href =
3434
document.URL.replace(/\/(?!.*\/).*/, '/').replace('#/./', '') + href;
3535
}

src/core/render/embed.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function walkFetchEmbed({ embedTokens, compile, fetch }, cb) {
2626
// Resolves relative links to absolute
2727
text = text.replace(/\[([^[\]]+)\]\(([^)]+)\)/g, x => {
2828
const linkBeginIndex = x.indexOf('(');
29-
if (x.substring(linkBeginIndex).startsWith('(.')) {
29+
if (x.slice(linkBeginIndex, linkBeginIndex + 2) === '(.') {
3030
return (
3131
x.substring(0, linkBeginIndex) +
3232
`(${window.location.protocol}//${window.location.host}${path}/` +

src/core/render/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ export function renderMixin(proto) {
255255

256256
if (hideSidebar) {
257257
// FIXME : better styling solution
258-
document.querySelector('aside.sidebar').remove();
259-
document.querySelector('button.sidebar-toggle').remove();
258+
[
259+
document.querySelector('aside.sidebar'),
260+
document.querySelector('button.sidebar-toggle'),
261+
].forEach(node => node.parentNode.removeChild(node));
260262
document.querySelector('section.content').style.right = 'unset';
261263
document.querySelector('section.content').style.left = 'unset';
262264
document.querySelector('section.content').style.position = 'relative';

src/plugins/search/search.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,9 @@ export function init(config, vm) {
245245

246246
if (Array.isArray(config.pathNamespaces)) {
247247
namespaceSuffix =
248-
config.pathNamespaces.find(prefix => path.startsWith(prefix)) ||
249-
namespaceSuffix;
248+
config.pathNamespaces.filter(
249+
prefix => path.slice(0, prefix.length) === prefix
250+
)[0] || namespaceSuffix;
250251
} else if (config.pathNamespaces instanceof RegExp) {
251252
const matches = path.match(config.pathNamespaces);
252253

0 commit comments

Comments
 (0)