From: mtmail Date: Wed, 10 Feb 2021 14:04:04 +0000 (+0100) Subject: link.href is always absolute URL, inspect raw HTML attribute instead (#60) X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/commitdiff_plain/6393226574761cd9c63651afa39015c77c87b68b?ds=sidebyside link.href is always absolute URL, inspect raw HTML attribute instead (#60) --- diff --git a/src/main.js b/src/main.js index a8269c6..8445501 100644 --- a/src/main.js +++ b/src/main.js @@ -25,9 +25,10 @@ document.addEventListener('click', function (e) { // loop parent nodes from the target to the delegation node for (var target = e.target; target && target !== this; target = target.parentNode) { - if (target.matches('a')) { - var target_url = target.href; + if (target.matches('a') && target.href) { + // target.href always contains the full absolute URL, inspect the raw value instead + var target_url = target.attributes.href.value; if (!is_relative_url(target_url)) return;