fix: Use legacy-compatible methods for IE11 (#1495)

This commit is contained in:
John Hildenbiddle 2021-02-07 10:44:18 -06:00 committed by GitHub
parent 759ffac992
commit 06cbebfc0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 7 deletions

View File

@ -73,7 +73,7 @@ export function fetchMixin(proto) {
case 'object':
key = Object.keys(notFoundPage)
.sort((a, b) => b.length - a.length)
.find(k => path.match(new RegExp('^' + k)));
.filter(k => path.match(new RegExp('^' + k)))[0];
path404 = (key && notFoundPage[key]) || defaultPath;
break;

View File

@ -29,7 +29,7 @@ export const linkCompiler = ({
href = router.toURL(href, null, router.getCurrentPath());
} else {
if (!isAbsolutePath(href) && href.startsWith('./')) {
if (!isAbsolutePath(href) && href.slice(0, 2) === './') {
href =
document.URL.replace(/\/(?!.*\/).*/, '/').replace('#/./', '') + href;
}

View File

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

View File

@ -255,8 +255,10 @@ export function renderMixin(proto) {
if (hideSidebar) {
// FIXME : better styling solution
document.querySelector('aside.sidebar').remove();
document.querySelector('button.sidebar-toggle').remove();
[
document.querySelector('aside.sidebar'),
document.querySelector('button.sidebar-toggle'),
].forEach(node => node.parentNode.removeChild(node));
document.querySelector('section.content').style.right = 'unset';
document.querySelector('section.content').style.left = 'unset';
document.querySelector('section.content').style.position = 'relative';

View File

@ -245,8 +245,9 @@ export function init(config, vm) {
if (Array.isArray(config.pathNamespaces)) {
namespaceSuffix =
config.pathNamespaces.find(prefix => path.startsWith(prefix)) ||
namespaceSuffix;
config.pathNamespaces.filter(
prefix => path.slice(0, prefix.length) === prefix
)[0] || namespaceSuffix;
} else if (config.pathNamespaces instanceof RegExp) {
const matches = path.match(config.pathNamespaces);