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
Whitespace around operator breaks nth-child selectors #20
Comments
That seems easy to fix, I will have a look asap. Probably these are the consequence of applying the following commit (security fix): Are you using latest version (2.0.8) ? |
Thanks for the quick response! Yes, I reproduced the issue on the latest version, see the test cases in my PR here: #21 (I'm not sure if my fix is the correct fix, but it does demonstrate the issue) I think if we're concerned about using |
Given this html page:
The selector
p:nth-child(2n + 1)
only works ifSIMPLENOT
is false:The same selector without whitespace,
p:nth-child(2n+1)
, works in both modes. The spec allows whitespace, so ideally both selectors should always work.In addition, prettier seems to autoformat CSS selectors with spaces in this situation. So this bug leads to a sad case where autoformatting your code with prettier can cause unit tests to break in the Jest -> JSDOM -> NWSAPI stack (or anything else relying on JSDOM to run tests).
Thanks for the help!
Edit: I believe the issue goes beyond
SIMPLE_NOT
, for example,p:nth-child(2n - 1)
doesn't work in either mode.The text was updated successfully, but these errors were encountered: