UNPKG

@mui/x-tree-view

Version:

The community edition of the MUI X Tree View components.

25 lines (23 loc) 835 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.escapeOperandAttributeSelector = escapeOperandAttributeSelector; exports.getActiveElement = void 0; // https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/ const getActiveElement = (root = document) => { const activeEl = root.activeElement; if (!activeEl) { return null; } if (activeEl.shadowRoot) { return getActiveElement(activeEl.shadowRoot); } return activeEl; }; // TODO, eventually replaces this function with CSS.escape, once available in jsdom, either added manually or built in // https://github.com/jsdom/jsdom/issues/1550#issuecomment-236734471 exports.getActiveElement = getActiveElement; function escapeOperandAttributeSelector(operand) { return operand.replace(/["\\]/g, '\\$&'); }