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 22:36:29 +02:00
committed by GitHub
parent ec00ee3c04
commit 15d2cbbc8c
+1 -1
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)) {