UNPKG

967 BJavaScriptView Raw
1/**
2 * Copyright 2013-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
8 *
9 */
10
11'use strict';
12
13var validateDOMNesting = require('./validateDOMNesting');
14
15var DOC_NODE_TYPE = 9;
16
17function ReactDOMContainerInfo(topLevelWrapper, node) {
18 var info = {
19 _topLevelWrapper: topLevelWrapper,
20 _idCounter: 1,
21 _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
22 _node: node,
23 _tag: node ? node.nodeName.toLowerCase() : null,
24 _namespaceURI: node ? node.namespaceURI : null
25 };
26 if (process.env.NODE_ENV !== 'production') {
27 info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
28 }
29 return info;
30}
31
32module.exports = ReactDOMContainerInfo;
\No newline at end of file