Reject selectors matching multiple elements — first-match-only sampling silently passes for siblings.
(
page: import("puppeteer-core").Page,
selectors: string[],
)
| 347 | |
| 348 | /** Reject selectors matching multiple elements — first-match-only sampling silently passes for siblings. */ |
| 349 | async 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 | |
| 368 | async function collectMotionFrames( |
| 369 | page: import("puppeteer-core").Page, |
no test coverage detected