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

Function getElementPosition

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

Source from the content-addressed store, hash-verified

116 * Get element's position relative to viewport
117 */
118export function getElementPosition(element) {
119 if (!element) return null;
120
121 const rect = element.getBoundingClientRect();
122 return {
123 top: rect.top,
124 left: rect.left,
125 bottom: rect.bottom,
126 right: rect.right,
127 width: rect.width,
128 height: rect.height,
129 centerX: rect.left + rect.width / 2,
130 centerY: rect.top + rect.height / 2
131 };
132}
133
134/**
135 * Extract label text for an element using multiple strategies

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected