lib/html2jsx.js
function (containerEl) {
    // Only a single child element
    if (
      containerEl.childNodes.length === 1
      && containerEl.childNodes[0].nodeType === NODE_TYPE.ELEMENT
    ) {
      return true;
    }
    // Only one element, and all other children are whitespace
    var foundElement = false;
    for (var i = 0, count = containerEl.childNodes.length; i < count; i++) {
      var child = containerEl.childNodes[i];
      if (child.nodeType === NODE_TYPE.ELEMENT) {
        if (foundElement) {
          // Encountered an element after already encountering another one
          // Therefore, more than one element at root level
          return false;
        } else {
          foundElement = true;
        }
      } else if (child.nodeType === NODE_TYPE.TEXT && !isEmpty(child.textContent)) {
        // Contains text content
        return false;
      }
    }
    return true;
  }
function (containerEl) {
    // Only a single child element
    if (
      containerEl.childNodes.length === 1
      && containerEl.childNodes[0].nodeType === NODE_TYPE.ELEMENT
    ) {
      return true;
    }
    // Only one element, and all other children are whitespace
    var foundElement = false;
    for (var i = 0, count = containerEl.childNodes.length; i < count; i++) {
      var child = containerEl.childNodes[i];
      if (child.nodeType === NODE_TYPE.ELEMENT) {
        if (foundElement) {
          // Encountered an element after already encountering another one
          // Therefore, more than one element at root level
          return false;
        } else {
          foundElement = true;
        }
      } else if (child.nodeType === NODE_TYPE.TEXT && !isEmpty(child.textContent)) {
        // Contains text content
        return false;
      }
    }
    return true;
  }
function ( containerEl ) { // Only a single child element if ( containerEl . childNodes . length === 1 && containerEl . childNodes [ 0 ] . nodeType === NODE_TYPE . ELEMENT ) { return true ; } // Only one element, and all other children are whitespace var foundElement = false ; for ( var i = 0 , count = containerEl . childNodes . length ; i < count ; i ++ ) { var child = containerEl . childNodes [ i ] ; if ( child . nodeType === NODE_TYPE . ELEMENT ) { if ( foundElement ) { // Encountered an element after already encountering another one // Therefore, more than one element at root level return false ; } else { foundElement = true ; } } else if ( child . nodeType === NODE_TYPE . TEXT && ! isEmpty ( child . textContent ) ) { // Contains text content return false ; } } return true ; }
Determines if there's only one top-level node in the DOM tree. That is,
all the HTML is wrapped by a single HTML tag.

@param {DOMElement} containerEl Container element
@return {boolean}
Determines if there s only one top - level node in the DOM tree . That is all the HTML is wrapped by a single HTML tag .