(node: Node)
| 1 | export function getOwnerDocument(node: Node): Document { |
| 2 | if (node.nodeType === Node.DOCUMENT_NODE) { |
| 3 | return node as Document; |
| 4 | } |
| 5 | const ownerDocument = node.ownerDocument; |
| 6 | if (!ownerDocument) { |
| 7 | throw new Error("Unable to resolve owner document for DOM node."); |
| 8 | } |
| 9 | return ownerDocument; |
| 10 | } |
| 11 | |
| 12 | export function getOwnerWindow(node: Node): Window { |
| 13 | const ownerWindow = getOwnerDocument(node).defaultView; |
no outgoing calls
no test coverage detected