From: Patrick Steinhardt Date: Sat, 20 May 2017 16:56:18 +0000 (+0200) Subject: hints: do not execute `click` in addition to opening hints X-Git-Url: https://git.owens.tech/rss.xml/rss.xml/git?a=commitdiff_plain;h=0237d64daed59ad00b64a998c2d619fb78278633;p=vimb.git hints: do not execute `click` in addition to opening hints When the element which we are about to open has a "href" attribute, we will execute either `window.open` or set the `window.location.href` attribute to the target's reference. But as we forgot to call `return` here, we will also execute the code to open elements without "href" attribute. In the case of opening a new window, we will now first open the new window and then also set the current window's URL to the target, which is obviously wrong. Fix the issue by putting the excution of `click()` inside an else-branch. --- diff --git a/src/scripts/hints.js b/src/scripts/hints.js index ceb86ed..4e8fd28 100644 --- a/src/scripts/hints.js +++ b/src/scripts/hints.js @@ -400,8 +400,9 @@ var hints = Object.freeze((function(){ } else { window.location.href = e.getAttribute('href'); } + } else { + window.setTimeout(function() {e.click();}, 0); } - window.setTimeout(function() {e.click();}, 0); } /* set focus on hint with given index valid hints array */