function getReactRootElementInContainer(container) {
  if (!container) {
    return null;
  }

  if (container.nodeType === DOC_NODE_TYPE) {
    return container.documentElement;
  } else {
    return container.firstChild;
  }
}
@param {DOMElement|DOMDocument} container DOM element that may contain
                                          a React component
@return {?*} DOM element that may have the reactRoot ID, or null.