main
js 29 lines 758 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 import {disableCommentsAsDOMContainers} from 'shared/ReactFeatureFlags';
11
12 import {
13 ELEMENT_NODE,
14 COMMENT_NODE,
15 DOCUMENT_NODE,
16 DOCUMENT_FRAGMENT_NODE,
17 } from './HTMLNodeType';
18
19 export function isValidContainer(node: any): boolean {
20 return !!(
21 node &&
22 (node.nodeType === ELEMENT_NODE ||
23 node.nodeType === DOCUMENT_NODE ||
24 node.nodeType === DOCUMENT_FRAGMENT_NODE ||
25 (!disableCommentsAsDOMContainers &&
26 node.nodeType === COMMENT_NODE &&
27 (node as any).nodeValue === ' react-mount-point-unstable '))
28 );
29 }