code: function root(node, options = {}) {
    const {
      fragment,
      namespace: optionsNamespace,
    } = options;
    const { children = [] } = node;
    const { length: childrenLength } = children;
  
    let namespace = optionsNamespace;
    let rootIsDocument = childrenLength === 0;
  
    for (let i = 0; i < childrenLength; i += 1) {
      const {
        tagName,
        properties: {
          xmlns,
        } = {},
      } = children[i];
      if (tagName === 'html') {
        // If we have a root HTML node, we don't need to render as a fragment
        rootIsDocument = true;
        // Take namespace of first child
        if (typeof optionsNamespace === 'undefined') {
          if (xmlns) {
            namespace = xmlns;
          } else if (children[0].tagName === 'html') {
            namespace = 'http://www.w3.org/1999/xhtml';
          }
        }
      }
    }
  
    // The root node will be a Document, DocumentFragment, or HTMLElement
    let el;
    if (rootIsDocument) {
      el = document.implementation.createDocument(namespace, '', null);
    } else if (fragment) {
      el = document.createDocumentFragment();
    } else {
      el = document.createElement('html');
    }
  
    // Transform children
    const childOptions = Object.assign({ fragment, namespace }, options);
    for (let i = 0; i < childrenLength; i += 1) {
      const childEl = transform(children[i], childOptions);
      if (childEl) {
        el.appendChild(childEl);
      }
    }
  
    return el;
  }
docs: Transform a document