MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / findAmbiguousSelectors

Function findAmbiguousSelectors

packages/cli/src/commands/layout.ts:349–366  ·  view source on GitHub ↗

Reject selectors matching multiple elements — first-match-only sampling silently passes for siblings.

(
  page: import("puppeteer-core").Page,
  selectors: string[],
)

Source from the content-addressed store, hash-verified

347
348/** Reject selectors matching multiple elements — first-match-only sampling silently passes for siblings. */
349async function findAmbiguousSelectors(
350 page: import("puppeteer-core").Page,
351 selectors: string[],
352): Promise<LayoutIssue[]> {
353 if (selectors.length === 0) return [];
354 const multiMatch = await page.evaluate(
355 (sels: string[]) =>
356 sels.filter((sel) => {
357 try {
358 return document.querySelectorAll(sel).length > 1;
359 } catch {
360 return false;
361 }
362 }),
363 selectors,
364 );
365 return multiMatch.map(ambiguousIssue);
366}
367
368async function collectMotionFrames(
369 page: import("puppeteer-core").Page,

Callers 1

runMotionPassFunction · 0.85

Calls 1

evaluateMethod · 0.80

Tested by

no test coverage detected