]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/main.js
link.href is always absolute URL, inspect raw HTML attribute instead (#60)
[nominatim-ui.git] / src / main.js
index a8269c6c44c729102b49b416de6c293a5afbf83a..8445501a86496b636799eb00791dbadc4fa31b26 100644 (file)
@@ -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;