diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 46bf3639..a0ac0bd3 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -42,47 +42,6 @@ DomUtils = document.evaluate(xpath, document.documentElement, namespaceResolver, resultType, null) # - # Returns all the clickable element children of contextNode. This also can include contextNode itself. - # - getClickableElements: (contextNode = document.documentElement) -> - elements = Array::slice.call(contextNode?.getElementsByTagName "*") - elements.unshift contextNode # Check the contextNode as well. - clickableElements = [] - for element in elements - isClickable = false - tagName = element.tagName.toLowerCase() - isClickable = (-> - if element.hasAttribute "onclick" - true - else if element.hasAttribute "tabindex" - true - else if element.getAttribute "role" in ["button", "link"] - true - else if element.getAttribute("class")?.toLowerCase().indexOf("button") >= 0 - true - else if element.getAttribute("contentEditable")?.toLowerCase() in ["", "contentEditable", "true"] - true - else if tagName == "a" - true - 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.readOnly) - else if (tagName == "input" and element.getAttribute("type")?.toLowerCase() != "hidden") or - tagName in ["button", "select"] - not element.disabled - else - false - )() - clickableElements.push element if isClickable - clickableElements - - # # Returns the first visible clientRect of an element if it exists. Otherwise it returns null. # getVisibleClientRect: (element) -> |
