Repository navigation
🐛 fix(css): keep rules led by a combinator - #2192
Merged
Merged
Conversation
A selector that starts with a combinator has no compound before the combinator, so the trailing-space trim after it could run past the selector's start. The selector is rendered into the shared pool after the body, and a custom property value at the end of the body can leave a space there. The trim removed bytes of earlier output and the combinator was written over them, so the rule could lose the combinator, turn into an at-rule, disappear, or merge into the rule before it. Every trim in the selector minifier now stops at the selector's start. The empty-prelude guard in css_parse_qualified existed only to undo the same overrun, so it is gone. Fixes tox-dev#1850
Merging this PR will not alter performance
Comparing Footnotes
|
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.
The CSS minifier could drop or merge a rule whose selector starts with a combinator (
>,+,~or,) when the rule before it ended with a custom property. The rule could lose its combinator, turn into an at-rule, vanish, or merge into the rule before it, which changes the elements it styles. 🧭 Once this merges, such a rule keeps its combinator and stays a separate rule. Fixes #1850.The selector minifier trims trailing spaces only within the selector it is writing, so it can no longer reach into the text of earlier rules in the shared buffer. The empty-prelude guard that covered the same overrun is removed.
Behavior changes
A rule whose selector starts with
>,+,~or,keeps its combinator in the cases above. Other input is unchanged.