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

Error on parenthesis in attribute value inside pseudo-class arg #71

Closed
slavaleleka opened this issue Dec 16, 2022 · 1 comment
Closed

Comments

@slavaleleka
Copy link
Contributor

slavaleleka commented Dec 16, 2022

Error on right parenthesis ) in attribute value inside pseudo-class arg

Basic info:

  • Node.js version: 16.14.0
  • jest version: 29.3.1
  • nwsapi version: 2.2.2

Minimal reproduction case

describe('right parenthesis in attribute', () => {
    // works fine
    it('1: simple selector', () => {
        const selector = '[data=")"]';
        expect(document.querySelectorAll(selector).length).toBe(0);
    });

    // fails
    it('2: inside pseudo-class arg', () => {
        const selector = 'div:not([data=")"])';
        expect(document.querySelectorAll(selector).length).toBe(0);
    });
});

There is no error with ) in attribute value inside pseudo-class arg if I check it in browser

@slavaleleka
Copy link
Contributor Author

somehow the combination of universal selector after combinator and left parenthesis in attribute value causes an error. case 3 below:

describe('left parenthesis in attribute', () => {
    // works fine
    it('1: simple selector', () => {
        const selector = '[data="("]';
        expect(document.querySelectorAll(selector).length).toBe(0);
    });

    // works fine
    it('2: inside pseudo-class arg', () => {
        const selector = 'body div:not([data="("])';
        expect(document.querySelectorAll(selector).length).toBe(0);
    });

    // fails
    it('3: universal selector for pseudo-class after combinator', () => {
        const selector = 'body *:not([data="("])';
        expect(document.querySelectorAll(selector).length).toBe(0);
    });

    // works fine
    it('4: universal selector for pseudo-class after combinator but no bracket in attr', () => {
        const selector = 'body *:not([data="123"])';
        expect(document.querySelectorAll(selector).length).toBe(0);
    });
});

@slavaleleka slavaleleka changed the title Error on right parenthesis ) in attribute value inside pseudo-class arg Error on parenthesis in attribute value inside pseudo-class arg Dec 21, 2022
@dperini dperini closed this as completed in d30410e Apr 6, 2023
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