From c3ddba69e3be5d1c9f9f13a571711b70a12552eb Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Mon, 26 Jan 2015 17:29:51 +0100 Subject: [PATCH] Do not consider links without href as proper links Links ending with a `#` (``) as well as `javascript:` links are already excluded, because they're used as buttons, not links. Links without href at all (``) should be excluded too, since they are also used as buttons (for example, the voting buttons on stackoverflow.com). If they're not excluded, all such links get the same hint, even though all of them do different things through JavaScript. Moreover, the 'F' and 'gF' commands would try to open them in new tabs, which of course wouldn't work. --- extension/lib/utils.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extension/lib/utils.coffee b/extension/lib/utils.coffee index 5f63337..978e428 100644 --- a/extension/lib/utils.coffee +++ b/extension/lib/utils.coffee @@ -94,9 +94,9 @@ blurActiveElement = (window) -> activeElement.blur() isProperLink = (element) -> - return (element instanceof HTMLAnchorElement or - (element.ownerDocument instanceof XULDocument and - element.hasAttribute('href'))) and + return element.hasAttribute('href') and + (element instanceof HTMLAnchorElement or + element.ownerDocument instanceof XULDocument) and not element.href.endsWith('#') and not element.href.startsWith('javascript:') -- 2.39.3