Closed birtles closed 4 months ago
It is not safe. Say a browser supports one of these selectors but not the other. If they are merged, the whole rule is thrown away by the browser rather than applying the supported selector. Lightning CSS has knowledge of the supported selectors of each browser and tries to merge if possible, but if it doesn't know about a selector it is conservative and keeps them separate to be on the safe side.
Right you are. I hadn't thought about that. Thank you!
Playground link
Input:
Expected:
Actual:
I only came across this because it looks like rspack's SwcCssMinimizerRspackPlugin does this while the Lightning plugin does not.
I guess it's safe to merge declaration blocks whose selectors include unrecognized pseudo-elements but maybe it's not common enough to worry about? Just filing this for completeness. Feel free to close it.