Skip to content

Fix end position of rules with ownSemicon#2012

Merged
ai merged 1 commit intopostcss:mainfrom
romainmenke:fix-end-position-of-rules-with-own-semicolon--compassionate-mule-bf9dceda22
Feb 10, 2025
Merged

Fix end position of rules with ownSemicon#2012
ai merged 1 commit intopostcss:mainfrom
romainmenke:fix-end-position-of-rules-with-own-semicolon--compassionate-mule-bf9dceda22

Conversation

@romainmenke
Copy link
Contributor

See: postcss/postcss-parser-tests#28

Rules with semicolons had these assigned to rule.raws.ownSemicolon and these are also used when serializing:

postcss/lib/stringifier.js

Lines 330 to 335 in 7b02c75

rule(node) {
this.block(node, this.rawValue(node, 'selector'))
if (node.raws.ownSemicolon) {
this.builder(node.raws.ownSemicolon, node, 'end')
}
}

However the source positions of the rules weren't adjusted after appending to rule.raws.ownSemicolon.

This change makes it so that slicing out the source range for a rule from the input CSS better matches rule.toString()

@ai ai merged commit ba587e3 into postcss:main Feb 10, 2025
9 checks passed
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

Successfully merging this pull request may close these issues.

2 participants