Skip to content

Remove: double functions #334

@frank-dspeed

Description

@frank-dspeed

We got maybe a logic error

  1757:24  error  This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain  no-dupe-else-if

Solution

menuStartTagInBody(p, token) === addressStartTagInBody(p, token) that leads to the conclusion as we also found double checks at case 4 condition in startTagInBody(

} else if (tn === $.MAIN || $.MENU ) {

OentStack.hasInButtonScope(tagName) maybe got abused to fix general wrong scoped elemens via

if ((tn === $.BUTTON && ns === NS.HTML) || isScopingElement(tn, ns)) {

to handle generic fixing the endTag position

parser

function addressStartTagInBody(p, token) {
    if (p.openElements.hasInButtonScope($.P)) {
        p._closePElement();
    }

    p._insertElement(token, NS.HTML);
}

openelementstack

    hasInButtonScope(tagName) {
        for (let i = this.stackTop; i >= 0; i--) {
            const tn = this.treeAdapter.getTagName(this.items[i]);
            const ns = this.treeAdapter.getNamespaceURI(this.items[i]);

            if (tn === tagName && ns === NS.HTML) {
                return true;
            }

            if ((tn === $.BUTTON && ns === NS.HTML) || isScopingElement(tn, ns)) {
                return false;
            }
        }

        return true;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions