Fixing the logic for `isExternalLink` (#2687)

`.href` is computed from the real value of the attribute,
and this was causing an issue where isExternalLink would
classify links that should not be external links as external links.
This commit is contained in:
Emma 2022-10-08 16:36:29 -04:00 committed by GitHub
parent ec00ee3c04
commit 15d2cbbc8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -320,7 +320,7 @@ export default Vue.extend({
},
openAllLinksExternally: function () {
const isExternalLink = (event) => event.target.tagName === 'A' && event.target.href.startsWith('http')
const isExternalLink = (event) => event.target.tagName === 'A' && !event.target.href.startsWith(window.location.origin)
document.addEventListener('click', (event) => {
if (isExternalLink(event)) {