aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authormrmr19932014-12-29 18:01:42 +0000
committermrmr19932014-12-29 18:01:42 +0000
commitecdf878c890bcc4ac67d2bb147dcca2e5c20dd27 (patch)
tree4dc51621e8a13f95cff142fc234c2b7a2b6b7a52 /content_scripts
parentda04ee17472177b7ae0474712090d0604db2556e (diff)
downloadvimium-ecdf878c890bcc4ac67d2bb147dcca2e5c20dd27.tar.bz2
Return an array from getVisibleClickable, to restore img map support
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/link_hints.coffee15
1 files changed, 8 insertions, 7 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index ea4be397..70e6a626 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -131,6 +131,7 @@ LinkHints =
tagName = element.tagName.toLowerCase()
isClickable = false
onlyHasTabIndex = false
+ visibleElements = []
# Insert area elements that provide click functionality to an img.
if tagName == "img"
@@ -183,12 +184,12 @@ LinkHints =
unless isClickable or isNaN(tabIndex) or tabIndex < 0
isClickable = onlyHasTabIndex = true
- return null unless isClickable # The element isn't clickable.
- clientRect = DomUtils.getVisibleClientRect element
- if clientRect == null
- null
- else
- {element: element, rect: clientRect, onlyHasTabIndex: onlyHasTabIndex}
+ if isClickable
+ clientRect = DomUtils.getVisibleClientRect element
+ if clientRect != null
+ visibleElements.push {element: element, rect: clientRect, onlyHasTabIndex: onlyHasTabIndex}
+
+ visibleElements
#
# Returns all clickable elements that are not hidden and are in the current viewport, along with rectangles
@@ -208,7 +209,7 @@ LinkHints =
# this, so it's necessary to check whether elements are clickable in order, as we do below.
for element in elements
visibleElement = @getVisibleClickable element
- visibleElements.push visibleElement if visibleElement?
+ visibleElements.push visibleElement...
# TODO(mrmr1993): Consider z-index. z-index affects behviour as follows:
# * The document has a local stacking context.