1 | ;
|
2 |
|
3 | /**
|
4 | * Copyright (c) Facebook, Inc. and its affiliates.
|
5 | *
|
6 | * This source code is licensed under the MIT license found in the
|
7 | * LICENSE file in the root directory of this source tree.
|
8 | *
|
9 | * @format
|
10 | *
|
11 | * @emails oncall+draft_js
|
12 | */
|
13 | function isInstanceOfNode(target) {
|
14 | // we changed the name because of having duplicate module provider (fbjs)
|
15 | if (!target || !('ownerDocument' in target)) {
|
16 | return false;
|
17 | }
|
18 |
|
19 | if ('ownerDocument' in target) {
|
20 | var node = target;
|
21 |
|
22 | if (!node.ownerDocument.defaultView) {
|
23 | return node instanceof Node;
|
24 | }
|
25 |
|
26 | if (node instanceof node.ownerDocument.defaultView.Node) {
|
27 | return true;
|
28 | }
|
29 | }
|
30 |
|
31 | return false;
|
32 | }
|
33 |
|
34 | module.exports = isInstanceOfNode; |
\ | No newline at end of file |