main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 2 weeks ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
383 bytes
|
Line | |
---|
1 | // @flow
|
---|
2 | import type { Window } from '../types';
|
---|
3 | declare function getWindow(node: Node | Window): Window;
|
---|
4 |
|
---|
5 | export default function getWindow(node) {
|
---|
6 | if (node == null) {
|
---|
7 | return window;
|
---|
8 | }
|
---|
9 |
|
---|
10 | if (node.toString() !== '[object Window]') {
|
---|
11 | const ownerDocument = node.ownerDocument;
|
---|
12 | return ownerDocument ? ownerDocument.defaultView || window : window;
|
---|
13 | }
|
---|
14 |
|
---|
15 | return node;
|
---|
16 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.