MCPcopy
hub / github.com/adobe/react-spectrum / getOwnerWindow

Function getOwnerWindow

packages/react-aria/src/utils/domHelpers.ts:5–14  ·  view source on GitHub ↗
(
  el: (Window & typeof globalThis) | Element | null | undefined
)

Source from the content-addressed store, hash-verified

3};
4
5export const getOwnerWindow = (
6 el: (Window & typeof globalThis) | Element | null | undefined
7): Window & typeof globalThis => {
8 if (el && 'window' in el && el.window === el) {
9 return el;
10 }
11
12 const doc = getOwnerDocument(el as Element | null | undefined);
13 return doc.defaultView || window;
14};
15
16/**
17 * 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