Repository navigation
Conversation
Whitespace before a pseudo-class or pseudo-element is a descendant combinator, so removing it changes which elements a rule matches. The selector branch only checked for a literal space, so a newline or tab was dropped. Use the whitespace already read before the current token and keep the existing space lookup for whitespace consumed by an earlier token. JS and Python implementations are updated together, with tests in the shared CSS test data.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
main)Fixes Issue: #2563
Whitespace before a pseudo-class or pseudo-element is a descendant combinator, so removing it changes which elements a rule matches. The selector branch only looked for a literal space, so a newline or a tab was dropped:
The whitespace before the current token is already read into
isAfterSpace, so the branch now keeps the space for any whitespace run. The existing literal-space lookup stays for whitespace consumed by an earlier token. Sass and Less parent references (&:hover) and existing single-space selectors are unchanged.Tests are added to
test/data/css/tests.js, which feeds the JS and Python suites. Without the change, the four new cases fail in both implementations (a:hover,ul::marker,h1:any-link,&:hover); with it they pass. The full JS source suite (39,301 JS / 4,847 CSS / 12,378 HTML tests) and the Python CSS suite pass.Before Merge Checklist