(container, initialChildren, parentComponent, callback, isHydrationContainer)
| 29530 | } |
| 29531 | |
| 29532 | function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) { |
| 29533 | if (isHydrationContainer) { |
| 29534 | if (typeof callback === 'function') { |
| 29535 | var originalCallback = callback; |
| 29536 | |
| 29537 | callback = function () { |
| 29538 | var instance = getPublicRootInstance(root); |
| 29539 | originalCallback.call(instance); |
| 29540 | }; |
| 29541 | } |
| 29542 | |
| 29543 | var root = createHydrationContainer(initialChildren, callback, container, LegacyRoot, null, // hydrationCallbacks |
| 29544 | false, // isStrictMode |
| 29545 | false, // concurrentUpdatesByDefaultOverride, |
| 29546 | '', // identifierPrefix |
| 29547 | noopOnRecoverableError); |
| 29548 | container._reactRootContainer = root; |
| 29549 | markContainerAsRoot(root.current, container); |
| 29550 | var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; |
| 29551 | listenToAllSupportedEvents(rootContainerElement); |
| 29552 | flushSync(); |
| 29553 | return root; |
| 29554 | } else { |
| 29555 | // First clear any existing content. |
| 29556 | var rootSibling; |
| 29557 | |
| 29558 | while (rootSibling = container.lastChild) { |
| 29559 | container.removeChild(rootSibling); |
| 29560 | } |
| 29561 | |
| 29562 | if (typeof callback === 'function') { |
| 29563 | var _originalCallback = callback; |
| 29564 | |
| 29565 | callback = function () { |
| 29566 | var instance = getPublicRootInstance(_root); |
| 29567 | |
| 29568 | _originalCallback.call(instance); |
| 29569 | }; |
| 29570 | } |
| 29571 | |
| 29572 | var _root = createContainer(container, LegacyRoot, null, // hydrationCallbacks |
| 29573 | false, // isStrictMode |
| 29574 | false, // concurrentUpdatesByDefaultOverride, |
| 29575 | '', // identifierPrefix |
| 29576 | noopOnRecoverableError); |
| 29577 | |
| 29578 | container._reactRootContainer = _root; |
| 29579 | markContainerAsRoot(_root.current, container); |
| 29580 | |
| 29581 | var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; |
| 29582 | |
| 29583 | listenToAllSupportedEvents(_rootContainerElement); // Initial mount should not be batched. |
| 29584 | |
| 29585 | flushSync(function () { |
| 29586 | updateContainer(initialChildren, _root, parentComponent, callback); |
| 29587 | }); |
| 29588 | return _root; |
| 29589 | } |
no test coverage detected
searching dependent graphs…