diff options
| author | Stephen Blott | 2015-08-22 11:09:55 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-08-22 11:09:55 +0100 |
| commit | 207c1591073c1577c50d37cc551cb25994ceca03 (patch) | |
| tree | 33a15887ebce1c5844604820f03e77414a853cb2 | |
| parent | b566b647ea13d715d3c9d1794e4e2516c251c35d (diff) | |
| parent | e0d38656038721e57ed106733151ae47e311ab50 (diff) | |
| download | vimium-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.coffee | 17 |
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 |
