aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dom_utils.coffee
diff options
context:
space:
mode:
authormrmr19932014-12-17 10:40:02 +0000
committermrmr19932014-12-17 10:40:02 +0000
commitc80ad2c367f873f2b2547b60cebe49715a85ffe4 (patch)
treeceeae6aaad83086bff4809abb13b5c34313fbeee /lib/dom_utils.coffee
parenta199335790aec50cf3ed7cc27c5b407875c37107 (diff)
downloadvimium-c80ad2c367f873f2b2547b60cebe49715a85ffe4.tar.bz2
Treat area elements as being at the point of their img element
Diffstat (limited to 'lib/dom_utils.coffee')
-rw-r--r--lib/dom_utils.coffee9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index 26fa9b81..152a378e 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -64,8 +64,13 @@ DomUtils =
true
else if tagName == "a"
true
- else if tagName == "area"
- element.hasAttribute "href"
+ else if tagName == "img"
+ mapName = element.getAttribute "usemap"
+ if mapName
+ map = document.querySelector(mapName.replace /^#/, "")
+ areas = Array::slice.call(map.getElementsByTagName "area")
+ elements.concat areas
+ false
else if (tagName == "input" and DomUtils.isSelectable element) or tagName == "textarea"
not (element.disabled or element.hasAttribute "readonly")
else if (tagName == "input" and element.getAttribute("type")?.toLowerCase() != "hidden") or