MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getOwnerWindow

Function getOwnerWindow

packages/react-aria/src/utils/domHelpers.ts:24–29  ·  view source on GitHub ↗
(target?: EventTarget | null)

Source from the content-addressed store, hash-verified

22};
23
24export const getOwnerWindow = (target?: EventTarget | null): Window & typeof globalThis => {
25 let ownerDocument = getOwnerDocument(target);
26
27 // @ts-expect-error Ensure safe access in SSR environments.
28 return ownerDocument?.defaultView ?? (typeof window !== 'undefined' ? window : undefined);
29};
30
31/**
32 * Type guard that checks if a value is a Node. Verifies the presence and type of the nodeType

Callers 15

domHelpers.test.jsFile · 0.90
Pressable.tsxFile · 0.90
usePressFunction · 0.90
isValidKeyboardEventFunction · 0.90
onMouseUpFunction · 0.90
useMoveFunction · 0.90
onTouchEndFunction · 0.90
onPointerUpFunction · 0.90
handleFocusEventFunction · 0.90
setupGlobalFocusEventsFunction · 0.90
isKeyboardFocusEventFunction · 0.90

Calls 1

getOwnerDocumentFunction · 0.85

Tested by

no test coverage detected