Selector.filterVisible Method
Returns visible elements.
Selector().filterVisible() → Selector
Visibility Criteria
The element is visible
if:
- The value of the element’s
display
property is notnone
- The value of the element’s
visibility
property is nothidden
- The element has a non-zero
width
andheight
Elements that meet the visibility criteria above may still be invisible to the user. The following factors do not influence the element’s visibility status:
- The element’s
z-index
- The element’s
opacity
- The element’s position on the page
Example
// Returns all visible div elements.
const visibleSelectors = Selector('div').filterVisible();