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

Some uses of :has throw "not a valid selector" #123

Open
aayla-secura opened this issue Aug 22, 2024 · 3 comments
Open

Some uses of :has throw "not a valid selector" #123

aayla-secura opened this issue Aug 22, 2024 · 3 comments

Comments

@aayla-secura
Copy link

aayla-secura commented Aug 22, 2024

I found two particular use cases of the :has selector, which work fine in modern browsers but nwsapi throws an error:

  • div:has(>div) results in '>div' is not a valid selector (so having > at the start of the subselector string is treated as invalid)
  • :has(div) results in '' is not a valid selector (so having :has at the start of the selector string seems to result in it being parsed as empty)

I believe the selectors above are valid and should be supported, am I wrong?

I should say I'm using version 2.2.12

@cee-chen
Copy link

+1ing this, the following selectors also throw "not a valid selector" errors for us in Jest (works fine in browsers):

Previous sibling selectors:

&:has(+ .classA) {
  color: red;
}

Nested :has/:is:

*:has(*:is(.classA, .classB)) + *:is(.classC, .classD) {
  color: red;
}

@BAISTM
Copy link

BAISTM commented Sep 13, 2024

@cee-chen The previous sibling selectors work with the version 2.2.7 of nswapi.

@sanpoChew
Copy link

sanpoChew commented Oct 1, 2024

it seems to be this MR that caused the regression #98, I can install the latest version and then revert that line and the issue is no longer there

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

4 participants