From b09e6a6379caec45dc540e8d6eeb81cb5e595a3c Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Sun, 21 May 2017 00:32:20 +0200
Subject: [PATCH] Don't attempt to open empty url by hinting.

There are pages where following links are used <a href="#"
onclick="...">...</a>. In this special case of href="#" the elements
should be clicked to let webkit decide how to handle the element instead
of opening current page with appended location mark.
---
 src/scripts/hints.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/scripts/hints.js b/src/scripts/hints.js
index 4e8fd28..f482bd7 100644
--- a/src/scripts/hints.js
+++ b/src/scripts/hints.js
@@ -387,18 +387,19 @@ var hints = Object.freeze((function(){
         /* We call open() and click() in async mode to avoid return as fast as possible. */
         /* If we don't return immediately, the EvalJS dbus call will probably timeout and cause */
         /* errors. */
-        if (e.hasAttribute('href')) {
+        var href;
+        if ((href = e.getAttribute('href')) && href != '#') {
             if (newWin) {
                 /* Since the "noopener" vulnerability thing, it's not possible to set an anchor's */
                 /* target to _blank. Therefore, we can't simulate ctrl-click through _blank like we */
                 /* used to. Therefore, we limit ourselves to "window.open()" in cases we're firing a */
                 /* simple <a> link. In other cases, we fire the even normally. */
                 window.setTimeout(function() {
-                    window.open(e.getAttribute('href'), '_blank');
+                    window.open(href, '_blank');
                     }, 0
                 );
             } else {
-                window.location.href = e.getAttribute('href');
+                window.location.href = href;
             }
         } else {
             window.setTimeout(function() {e.click();}, 0);
-- 
2.20.1