From fd1a722c93e6ac8f136a7658697d655a6172067e Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Tue, 3 Mar 2015 19:51:49 +0100 Subject: [PATCH] Do not treat `` as links Some sites use those as buttons. `element.href === window.location` in that case. Otherwise several such "buttons" might get the same hint. --- extension/lib/utils.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extension/lib/utils.coffee b/extension/lib/utils.coffee index 4d05fb9..138e3b4 100644 --- a/extension/lib/utils.coffee +++ b/extension/lib/utils.coffee @@ -94,7 +94,9 @@ blurActiveElement = (window) -> activeElement.blur() isProperLink = (element) -> - return element.hasAttribute('href') and + # `.getAttribute` is used below instead of `.hasAttribute` to exclude ``s used as buttons on some sites. + return element.getAttribute('href') and (element instanceof HTMLAnchorElement or element.ownerDocument instanceof XULDocument) and not element.href.endsWith('#') and -- 2.39.3