Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove: double functions #334

Closed
frank-dspeed opened this issue Mar 11, 2021 · 1 comment
Closed

Remove: double functions #334

frank-dspeed opened this issue Mar 11, 2021 · 1 comment

Comments

@frank-dspeed
Copy link

frank-dspeed commented Mar 11, 2021

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;
    }
@frank-dspeed
Copy link
Author

Closed in fork no need to close that here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant