code: function insertComment(data) {
      var parent = stack.top;
      if (foster_parent_mode && isA(parent, tablesectionrowSet)) {
        fosterParent(function(doc) { return doc.createComment(data); });
      } else {
        // "If the adjusted insertion location is inside a template element,
        // let it instead be inside the template element's template contents"
        if (parent instanceof impl.HTMLTemplateElement) {
          parent = parent.content;
        }
        parent._appendChild(parent.ownerDocument.createComment(data));
      }
    }
docs: *
  Tree building utility functions