Skip to content

Commit

Permalink
fix: Use legacy-compatible methods for IE11 (#1495)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhildenbiddle committed Feb 7, 2021
1 parent 759ffac commit 06cbebf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/core/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/render/compiler/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/render/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}/` +
Expand Down
6 changes: 4 additions & 2 deletions src/core/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

1 comment on commit 06cbebf

@vercel
Copy link

@vercel vercel bot commented on 06cbebf Feb 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.