lib/HTMLParser.js
function insertElement(eltFunc) {
    var elt;
    if (foster_parent_mode && isA(stack.top, tablesectionrowSet)) {
      elt = fosterParent(eltFunc);
    }
    else if (stack.top instanceof impl.HTMLTemplateElement) {
      // "If the adjusted insertion location is inside a template element,
      // let it instead be inside the template element's template contents"
      elt = eltFunc(stack.top.content.ownerDocument);
      stack.top.content._appendChild(elt);
    } else {
      elt = eltFunc(stack.top.ownerDocument);
      stack.top._appendChild(elt);
    }

    stack.push(elt);
    return elt;
  }
function insertElement(eltFunc) {
    var elt;
    if (foster_parent_mode && isA(stack.top, tablesectionrowSet)) {
      elt = fosterParent(eltFunc);
    }
    else if (stack.top instanceof impl.HTMLTemplateElement) {
      // "If the adjusted insertion location is inside a template element,
      // let it instead be inside the template element's template contents"
      elt = eltFunc(stack.top.content.ownerDocument);
      stack.top.content._appendChild(elt);
    } else {
      elt = eltFunc(stack.top.ownerDocument);
      stack.top._appendChild(elt);
    }

    stack.push(elt);
    return elt;
  }
function insertElement ( eltFunc ) { var elt ; if ( foster_parent_mode && isA ( stack . top , tablesectionrowSet ) ) { elt = fosterParent ( eltFunc ) ; } else if ( stack . top instanceof impl . HTMLTemplateElement ) { // "If the adjusted insertion location is inside a template element, // let it instead be inside the template element's template contents" elt = eltFunc ( stack . top . content . ownerDocument ) ; stack . top . content . _appendChild ( elt ) ; } else { elt = eltFunc ( stack . top . ownerDocument ) ; stack . top . _appendChild ( elt ) ; } stack . push ( elt ) ; return elt ; }
Insert the element into the open element or foster parent it
Insert the element into the open element or foster parent it