diff options
| author | Stephen Blott | 2016-02-27 05:26:07 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-02-27 05:26:07 +0000 |
| commit | cf08ac3f189d91551c52f8faee3aa04596523768 (patch) | |
| tree | 955a555a42b028c7c4d035ba2b633b4204ec281f | |
| parent | e33fbadb834f3f51599780eab9a7d85244a1b380 (diff) | |
| parent | a3cf3d18e94d5d3f39db3e08fdd05a610f55d684 (diff) | |
| download | vimium-cf08ac3f189d91551c52f8faee3aa04596523768.tar.bz2 | |
Merge pull request #2020 from mrmr1993/remove-old-redundant-exclusions
Remove outdated blacklist in DomUtils.isEditable, use DomUtils.isSelectable
| -rw-r--r-- | lib/dom_utils.coffee | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index db90c43a..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 @@ -179,12 +180,7 @@ DomUtils = # enter insert mode if focused. Also note that the "contentEditable" attribute can be set on any element # which makes it a rich text editor, like the notes on jjot.com. isEditable: (element) -> - return true if element.isContentEditable - nodeName = element.nodeName?.toLowerCase() - # Use a blacklist instead of a whitelist because new form controls are still being implemented for html5. - if nodeName == "input" and element.type not in ["radio", "checkbox"] - return true - nodeName in ["textarea", "select"] + (@isSelectable element) or element.nodeName?.toLowerCase() == "select" # Embedded elements like Flash and quicktime players can obtain focus. isEmbed: (element) -> |
