(target?: EventTarget | null)
| 13 | import type {EventMapType} from '@react-types/shared'; |
| 14 | |
| 15 | export const getOwnerDocument = (target?: EventTarget | null): Document => { |
| 16 | if (isWindow(target)) return target.document; |
| 17 | |
| 18 | if (isDocument(target)) return target; |
| 19 | |
| 20 | // @ts-expect-error Ensure safe access in SSR environments. |
| 21 | return target?.ownerDocument ?? (typeof document !== 'undefined' ? document : undefined); |
| 22 | }; |
| 23 | |
| 24 | export const getOwnerWindow = (target?: EventTarget | null): Window & typeof globalThis => { |
| 25 | let ownerDocument = getOwnerDocument(target); |
no test coverage detected