ITADN

Bug: Incorrect transformation with nested attribute selector after direct descendant (`>`)

#1704ClosedAXT-AyaKoto 创建于 2025-10-22
A
AXT-AyaKotocommented
### Bug description The plugin produces an incorrect transformation when nesting an attribute selector (like &[data-test]) within a selector that already uses a direct descendant combinator (>). Instead of correctly appending the attribute selector to the parent (e.g., .a>.b[data-test]), it generates an incorrect selector using :is() (e.g., [data-test]:is(.a > .b)). ### Source CSS ```css .a { &>.b[data-test] { color: green; } } .a { &>.b { &[data-test] { color: green; } } } .a>.b { &[data-test] { color: green; } } ``` ### Expected CSS ```css .a>.b[data-test] { color: green; } .a>.b[data-test] { color: green; } .a>.b[data-test] { color: green; } ``` ### Actual CSS ```css .a>.b[data-test] { color: green; } [data-test]:is(.a > .b) { color: green; } [data-test]:is(.a > .b) { color: green; } ``` ### Playgound example _No response_ ### Does it happen with `npx @csstools/csstools-cli <plugin-name> minimal-example.css`? None ### Debug output _No response_ ### Extra config _No response_ ### What plugin are you experiencing this issue on? _No response_ ### Plugin version 13.0.2 ### What OS are you experiencing this on? macOS ### Node Version 22.19.0 ### Validations - [x] Follow our [Code of Conduct](https://github.com/csstools/postcss-plugins/blob/master/CODE_OF_CONDUCT.md) - [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate. ### Would you like to open a PR for this bug? - [ ] I'm willing to open a PR
关闭于 2025-10-22 3 条评论