Namespace: dom

hobs.utils. dom

DOM related utils

Methods


<static> elementIsVisible(elem)

Checks real visibility of a DOM element.

A DOM element elem is considered visible if all the following criterias are true:

  • elem exists in the DOM
  • elem does not have a CSS property making it invisible (display, visibility, opacity)
  • elem does not have an invisible parentVisible
  • elem is in the viewport
  • elem top left corner point is not overlayed by another DOM element
Parameters:
Name Type Description
elem string | DOMElement

The element to check (if string, considered as a jQuery selector that will be searched using hobs.find)

Returns:

boolean true if the element is visible To be considered visible, elem


<static> getXPath(el)

Get XPath string representation of a DOM element.

Parameters:
Name Type Description
el string | DOMElement

The DOM element to evaluate

Returns:

string XPath string representation of the given element