(CSS) Fix nesting lowering with complex sub selectors#4037
(CSS) Fix nesting lowering with complex sub selectors#4037tim-we wants to merge 1 commit intoevanw:mainfrom tim-we:fix-nesting-lowering
Conversation
|
Hello @sanoojes, this is PR that did not get accepted, the issue was solved in a different way. If you think this is not fixed either comment on #3620 or create a new issue. |
|
ohh sorry to comment here also apologies if i made mistakes |
|
@sanoojes this PR and the issue #3620 is about the correctness of the transformation. If I understand you correctly you just don't want any I wonder why you want that, as If you change the browser version you can see the effect: |



This PR fixes the issue described in #3620.
When nesting is lowered (for example when the target is Chrome 117) the current version of esbuild will transform this:
into this (playground link)
which is wrong because
.parent > :is(.b1 > .b2)is semantically different from.parent > .b1 > .b2.With the change in this PR the output will instead be this:
I have added a test for this as well. The fix is in the first pass of the
lowerNestingInRuleWithContextmethod. When a nested complex selector is sufficiently complex (has another combinator) the transformation will be disabled.