From 0845cd19612dc7c23c6c5b2c1bedf46e8d9c6ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20M=C3=A1t=C3=A9?= Date: Fri, 12 Apr 2024 18:23:55 +0200 Subject: [PATCH 1/2] Excluding anchor tags without href attribute --- Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js b/Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js index d6fd9612..be6e9ca1 100644 --- a/Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js +++ b/Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js @@ -9,7 +9,8 @@ // In the current script, we are not using them. // eslint-disable-next-line no-script-url !links[i].href.startsWith('javascript:') && - !links[i].href.startsWith('mailto:')) { + !links[i].href.startsWith('mailto:') && + links[i].href.length > 0) { links[i].setAttribute('target', '_blank'); } } From 47301da29622c7dca60ef640313ff7b192fd73e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20M=C3=A1t=C3=A9?= <99020631+MZole@users.noreply.github.com> Date: Tue, 16 Apr 2024 22:31:48 +0200 Subject: [PATCH 2/2] Update Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js Co-authored-by: Szabolcs Deme <80963259+DemeSzabolcs@users.noreply.github.com> --- Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js b/Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js index be6e9ca1..42752dca 100644 --- a/Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js +++ b/Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js @@ -10,7 +10,7 @@ // eslint-disable-next-line no-script-url !links[i].href.startsWith('javascript:') && !links[i].href.startsWith('mailto:') && - links[i].href.length > 0) { + links[i].href) { links[i].setAttribute('target', '_blank'); } }