Blame view

node_modules/@popperjs/core/lib/dom-utils/getWindow.js.flow 383 Bytes
4cd4fd28   郭伟龙   feat: 初始化项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// @flow
import type { Window } from '../types';
declare function getWindow(node: Node | Window): Window;

export default function getWindow(node) {
  if (node == null) {
    return window;
  }

  if (node.toString() !== '[object Window]') {
    const ownerDocument = node.ownerDocument;
    return ownerDocument ? ownerDocument.defaultView || window : window;
  }

  return node;
}