(element: HTMLElement)
| 20 | |
| 21 | /** Gets the shadow root of an element, if supported and the element is inside the Shadow DOM. */ |
| 22 | export function _getShadowRoot(element: HTMLElement): ShadowRoot | null { |
| 23 | if (_supportsShadowDom()) { |
| 24 | const rootNode = element.getRootNode ? element.getRootNode() : null; |
| 25 | |
| 26 | // Note that this should be caught by `_supportsShadowDom`, but some |
| 27 | // teams have been able to hit this code path on unsupported browsers. |
| 28 | if (typeof ShadowRoot !== 'undefined' && ShadowRoot && rootNode instanceof ShadowRoot) { |
| 29 | return rootNode; |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | return null; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Gets the currently-focused element on the page while |
no test coverage detected