(container, initialChildren, parentComponent, callback, isHydrationContainer)
| 29569 | } |
| 29570 | |
| 29571 | function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) { |
| 29572 | if (isHydrationContainer) { |
| 29573 | if (typeof callback === 'function') { |
| 29574 | var originalCallback = callback; |
| 29575 | |
| 29576 | callback = function () { |
| 29577 | var instance = getPublicRootInstance(root); |
| 29578 | originalCallback.call(instance); |
| 29579 | }; |
| 29580 | } |
| 29581 | |
| 29582 | var root = createHydrationContainer(initialChildren, callback, container, LegacyRoot, null, // hydrationCallbacks |
| 29583 | false, // isStrictMode |
| 29584 | false, // concurrentUpdatesByDefaultOverride, |
| 29585 | '', // identifierPrefix |
| 29586 | noopOnRecoverableError); |
| 29587 | container._reactRootContainer = root; |
| 29588 | markContainerAsRoot(root.current, container); |
| 29589 | var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; |
| 29590 | listenToAllSupportedEvents(rootContainerElement); |
| 29591 | flushSync(); |
| 29592 | return root; |
| 29593 | } else { |
| 29594 | // First clear any existing content. |
| 29595 | var rootSibling; |
| 29596 | |
| 29597 | while (rootSibling = container.lastChild) { |
| 29598 | container.removeChild(rootSibling); |
| 29599 | } |
| 29600 | |
| 29601 | if (typeof callback === 'function') { |
| 29602 | var _originalCallback = callback; |
| 29603 | |
| 29604 | callback = function () { |
| 29605 | var instance = getPublicRootInstance(_root); |
| 29606 | |
| 29607 | _originalCallback.call(instance); |
| 29608 | }; |
| 29609 | } |
| 29610 | |
| 29611 | var _root = createContainer(container, LegacyRoot, null, // hydrationCallbacks |
| 29612 | false, // isStrictMode |
| 29613 | false, // concurrentUpdatesByDefaultOverride, |
| 29614 | '', // identifierPrefix |
| 29615 | noopOnRecoverableError); |
| 29616 | |
| 29617 | container._reactRootContainer = _root; |
| 29618 | markContainerAsRoot(_root.current, container); |
| 29619 | |
| 29620 | var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; |
| 29621 | |
| 29622 | listenToAllSupportedEvents(_rootContainerElement); // Initial mount should not be batched. |
| 29623 | |
| 29624 | flushSync(function () { |
| 29625 | updateContainer(initialChildren, _root, parentComponent, callback); |
| 29626 | }); |
| 29627 | return _root; |
| 29628 | } |
no test coverage detected
searching dependent graphs…