UNPKG

playwright-fluent

Version:
21 lines (20 loc) 622 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasHandleFocus = void 0; async function hasHandleFocus(selector) { if (selector === undefined || selector === null) { return false; } const result = await selector.evaluate((el) => { const focusedElement = window.document.activeElement; if (!focusedElement) { return false; } if (focusedElement.tagName !== el.tagName) { return false; } return focusedElement.isSameNode(el); }); return result; } exports.hasHandleFocus = hasHandleFocus;