Buckets:
ktongue/docker_container / fem_tutos /node_modules /@mui /utils /esm /getActiveElement /getActiveElement.js
| /** | |
| * Gets the actual active element, traversing through shadow roots if necessary. | |
| * | |
| * When an element inside a shadow root has focus, `document.activeElement` returns | |
| * the shadow host element. This function recursively traverses shadow roots to find | |
| * the actual focused element. | |
| * | |
| * @param root - The document or shadow root to start the search from. | |
| * @returns The actual focused element, or null if no element has focus. | |
| * | |
| * @example | |
| * // In a shadow DOM context | |
| * const activeElement = getActiveElement(document); | |
| * // Returns the actual focused element inside the shadow root | |
| * | |
| * @example | |
| * // Starting from a specific document | |
| * const activeElement = getActiveElement(ownerDocument(element)); | |
| */ | |
| export default function activeElement(doc) { | |
| let element = doc.activeElement; | |
| while (element?.shadowRoot?.activeElement != null) { | |
| element = element.shadowRoot.activeElement; | |
| } | |
| return element; | |
| } |
Xet Storage Details
- Size:
- 929 Bytes
- Xet hash:
- 6f8c1d2525b7b809c4580b8bac3d80a47e9d046d701d038423dd2994a38d2fd1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.