From: Daniel Carl Date: Sat, 20 May 2017 22:32:20 +0000 (+0200) Subject: Don't attempt to open empty url by hinting. X-Git-Url: https://git.owens.tech/git.owens.tech/git.owens.tech/git?a=commitdiff_plain;h=b09e6a6379caec45dc540e8d6eeb81cb5e595a3c;p=vimb.git Don't attempt to open empty url by hinting. There are pages where following links are used .... 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. --- 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 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);