aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-08-22 11:09:55 +0100
committerStephen Blott2015-08-22 11:09:55 +0100
commit207c1591073c1577c50d37cc551cb25994ceca03 (patch)
tree33a15887ebce1c5844604820f03e77414a853cb2
parentb566b647ea13d715d3c9d1794e4e2516c251c35d (diff)
parente0d38656038721e57ed106733151ae47e311ab50 (diff)
downloadvimium-207c1591073c1577c50d37cc551cb25994ceca03.tar.bz2
Merge pull request #1745 from poacher2k/patch-1
Add support for ngClick to link hints
-rw-r--r--content_scripts/link_hints.coffee17
1 files changed, 17 insertions, 0 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 15af15c5..8e106b0f 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -167,6 +167,23 @@ class LinkHintsMode
element.getAttribute("aria-disabled")?.toLowerCase() in ["", "true"])
return [] # This element should never have a link hint.
+ # Check for AngularJS listeners on the element.
+ @checkForAngularJs ?= do ->
+ angularElements = document.getElementsByClassName "ng-scope"
+ if angularElements.length == 0
+ -> false
+ else
+ ngAttributes = []
+ for prefix in [ '', 'data-', 'x-' ]
+ for separator in [ '-', ':', '_' ]
+ ngAttributes.push "#{prefix}ng#{separator}click"
+ (element) ->
+ for attribute in ngAttributes
+ return true if element.hasAttribute attribute
+ false
+
+ isClickable ||= @checkForAngularJs element
+
# Check for attributes that make an element clickable regardless of its tagName.
if (element.hasAttribute("onclick") or
element.getAttribute("role")?.toLowerCase() in ["button", "link"] or