If you take a selector like .class-a :where(.class-b, .class-c) and try prefixing it with .prefix-class, it results in a selector .prefix-class .class-a :where(.class-b, .prefix-class .class-c), which is incorrect. I think the expected result should be .prefix-class .class-a :where(.class-b, .class-c)
I think the AST does provide an already split cssRule.selectors property, so splitting the string might not be needed, it may be ok to lean on what the AST provides.
If you take a selector like
.class-a :where(.class-b, .class-c)
and try prefixing it with.prefix-class
, it results in a selector.prefix-class .class-a :where(.class-b, .prefix-class .class-c)
, which is incorrect. I think the expected result should be.prefix-class .class-a :where(.class-b, .class-c)
It appears to be because the code splits a selector string using the string
.split( ',' )
method: https://github.com/dbtedman/postcss-prefixwrap/blob/c2636cdaa8381741df1b2b553d15a82d1e674802/src/internal/domain/CSSRuleWrapper.ts#L20-L21I think the AST does provide an already split
cssRule.selectors
property, so splitting the string might not be needed, it may be ok to lean on what the AST provides.