MCPcopy Create free account
hub / github.com/microsoft/SandDance / appendChildToContainer

Function appendChildToContainer

docs/external/js/react-dom.development.js:7687–7712  ·  view source on GitHub ↗
(container, child)

Source from the content-addressed store, hash-verified

7685 parentInstance.appendChild(child);
7686 }
7687 function appendChildToContainer(container, child) {
7688 var parentNode;
7689
7690 if (container.nodeType === COMMENT_NODE) {
7691 parentNode = container.parentNode;
7692 parentNode.insertBefore(child, container);
7693 } else {
7694 parentNode = container;
7695 parentNode.appendChild(child);
7696 } // This container might be used for a portal.
7697 // If something inside a portal is clicked, that click should bubble
7698 // through the React tree. However, on Mobile Safari the click would
7699 // never bubble through the *DOM* tree unless an ancestor with onclick
7700 // event exists. So we wouldn't see it and dispatch it.
7701 // This is why we ensure that non React root containers have inline onclick
7702 // defined.
7703 // https://github.com/facebook/react/issues/11918
7704
7705
7706 var reactRootContainer = container._reactRootContainer;
7707
7708 if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) {
7709 // TODO: This cast may not be sound for SVG, MathML or custom elements.
7710 trapClickOnNonInteractiveElement(parentNode);
7711 }
7712 }
7713 function insertBefore(parentInstance, child, beforeChild) {
7714 parentInstance.insertBefore(child, beforeChild);
7715 }

Calls 1

Tested by

no test coverage detected