aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormrmr19932016-02-26 20:03:17 +0000
committermrmr19932016-02-26 20:03:17 +0000
commita3cf3d18e94d5d3f39db3e08fdd05a610f55d684 (patch)
tree955a555a42b028c7c4d035ba2b633b4204ec281f /lib
parent2a631ab75bc23a30f890fa5c557c684225b7bb81 (diff)
downloadvimium-a3cf3d18e94d5d3f39db3e08fdd05a610f55d684.tar.bz2
Don't try to evaluate DomUtils.isSelectable on non-elements
This stops us from throwing errors when document, window, etc. end up being passed into DomUtils.isSelectable.
Diffstat (limited to 'lib')
-rw-r--r--lib/dom_utils.coffee1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index 7f18e643..553287af 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -171,6 +171,7 @@ DomUtils =
# An unknown type will be treated the same as "text", in the same way that the browser does.
#
isSelectable: (element) ->
+ return false unless element instanceof Element
unselectableTypes = ["button", "checkbox", "color", "file", "hidden", "image", "radio", "reset", "submit"]
(element.nodeName.toLowerCase() == "input" && unselectableTypes.indexOf(element.type) == -1) ||
element.nodeName.toLowerCase() == "textarea" || element.isContentEditable