Skip to content

Commit

Permalink
Excluding anchor tags without href attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
MZole committed Apr 12, 2024
1 parent 66ca0be commit 0845cd1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Lombiq.HelpfulExtensions/Assets/Scripts/target-blank.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
Expand Down

0 comments on commit 0845cd1

Please sign in to comment.