MCPcopy Create free account
hub / github.com/InverseUI/InverseUI-Recorder / isElementVisible

Function isElementVisible

util/dom_utils.js:34–47  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

32 * Check if element is visible to user
33 */
34export function isElementVisible(element) {
35 if (!element) return false;
36
37 const style = window.getComputedStyle(element);
38 const rect = element.getBoundingClientRect();
39
40 return style.display !== 'none' &&
41 style.visibility !== 'hidden' &&
42 style.opacity !== '0' &&
43 rect.width > 0 &&
44 rect.height > 0 &&
45 (rect.top + rect.height) > 0 &&
46 (rect.left + rect.width) > 0;
47}
48
49/**
50 * Validate XPath syntax and check if it finds elements

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected