MCPcopy Create free account
hub / github.com/donghaxkim/react-rewrite / buildFallbackSelection

Function buildFallbackSelection

packages/overlay/src/selection.ts:190–209  ·  view source on GitHub ↗
(el: HTMLElement)

Source from the content-addressed store, hash-verified

188}
189
190function buildFallbackSelection(el: HTMLElement): ResolvedComponent {
191 const tagName = el.tagName.toLowerCase();
192 const dataName = el.getAttribute("data-component-name")?.trim();
193 const ariaLabel = el.getAttribute("aria-label")?.trim();
194 const textLabel = el.textContent?.trim();
195 const componentName =
196 dataName ||
197 ariaLabel ||
198 (textLabel ? textLabel.slice(0, 24) : "") ||
199 `<${tagName}>`;
200
201 return {
202 tagName,
203 componentName,
204 filePath: "",
205 lineNumber: 0,
206 columnNumber: 0,
207 stack: [],
208 };
209}
210
211function getCanonicalSelectableElement(clientX: number, clientY: number): HTMLElement | null {
212 const pageEl = getPageElementAtPoint(clientX, clientY);

Callers 1

selectElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected