packages/parse5/lib/parser/index.js
function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) {
    if (p._isElementCausesFosterParenting(commonAncestor)) {
        p._fosterParentElement(lastElement);
    } else {
        const tn = p.treeAdapter.getTagName(commonAncestor);
        const ns = p.treeAdapter.getNamespaceURI(commonAncestor);

        if (tn === $.TEMPLATE && ns === NS.HTML) {
            commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor);
        }

        p.treeAdapter.appendChild(commonAncestor, lastElement);
    }
}
function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) {
    if (p._isElementCausesFosterParenting(commonAncestor)) {
        p._fosterParentElement(lastElement);
    } else {
        const tn = p.treeAdapter.getTagName(commonAncestor);
        const ns = p.treeAdapter.getNamespaceURI(commonAncestor);

        if (tn === $.TEMPLATE && ns === NS.HTML) {
            commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor);
        }

        p.treeAdapter.appendChild(commonAncestor, lastElement);
    }
}
function aaInsertLastNodeInCommonAncestor ( p , commonAncestor , lastElement ) { if ( p . _isElementCausesFosterParenting ( commonAncestor ) ) { p . _fosterParentElement ( lastElement ) ; } else { const tn = p . treeAdapter . getTagName ( commonAncestor ) ; const ns = p . treeAdapter . getNamespaceURI ( commonAncestor ) ; if ( tn === $ . TEMPLATE && ns === NS . HTML ) { commonAncestor = p . treeAdapter . getTemplateContent ( commonAncestor ) ; } p . treeAdapter . appendChild ( commonAncestor , lastElement ) ; } }
Step 14 of the algorithm
Step 14 of the algorithm