File tree Expand file tree Collapse file tree 3 files changed +85
-1
lines changed
packages/tailwindcss/src/compat Expand file tree Collapse file tree 3 files changed +85
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
20
- Ensure ` @reference "…" ` does not emit CSS variables ([ #16774 ] ( https://github.com/tailwindlabs/tailwindcss/pull/16774 ) )
21
21
- Fix an issue where ` @reference "…" ` would sometimes omit keyframe animations ([ #16774 ] ( https://github.com/tailwindlabs/tailwindcss/pull/16774 ) )
22
22
- Ensure ` z-*! ` utilities are property marked as ` !important ` ([ #16795 ] ( https://github.com/tailwindlabs/tailwindcss/pull/16795 ) )
23
+ - Ensure nested functions in selectors used with JavaScript plugins are not truncated
23
24
24
25
## [ 4.0.8] - 2025-02-21
25
26
Original file line number Diff line number Diff line change @@ -77,6 +77,85 @@ describe('parse', () => {
77
77
} ,
78
78
] )
79
79
} )
80
+
81
+ it ( 'parses &:has(.child:nth-child(2))' , ( ) => {
82
+ expect ( parse ( '&:has(.child:nth-child(2))' ) ) . toEqual ( [
83
+ {
84
+ kind : 'selector' ,
85
+ value : '&' ,
86
+ } ,
87
+ {
88
+ kind : 'function' ,
89
+ value : ':has' ,
90
+ nodes : [
91
+ {
92
+ kind : 'selector' ,
93
+ value : '.child' ,
94
+ } ,
95
+ {
96
+ kind : 'function' ,
97
+ value : ':nth-child' ,
98
+ nodes : [
99
+ {
100
+ kind : 'value' ,
101
+ value : '2' ,
102
+ } ,
103
+ ] ,
104
+ } ,
105
+ ] ,
106
+ } ,
107
+ ] )
108
+ } )
109
+
110
+ it ( 'parses &:has(:nth-child(2))' , ( ) => {
111
+ expect ( parse ( '&:has(:nth-child(2))' ) ) . toEqual ( [
112
+ {
113
+ kind : 'selector' ,
114
+ value : '&' ,
115
+ } ,
116
+ {
117
+ kind : 'function' ,
118
+ value : ':has' ,
119
+ nodes : [
120
+ {
121
+ kind : 'function' ,
122
+ value : ':nth-child' ,
123
+ nodes : [
124
+ {
125
+ kind : 'value' ,
126
+ value : '2' ,
127
+ } ,
128
+ ] ,
129
+ } ,
130
+ ] ,
131
+ } ,
132
+ ] )
133
+ } )
134
+
135
+ it ( 'parses :not(:nth-child(1))' , ( ) => {
136
+ expect ( parse ( '&:not(:nth-child(1))' ) ) . toEqual ( [
137
+ {
138
+ kind : 'selector' ,
139
+ value : '&' ,
140
+ } ,
141
+ {
142
+ kind : 'function' ,
143
+ value : ':not' ,
144
+ nodes : [
145
+ {
146
+ kind : 'function' ,
147
+ value : ':nth-child' ,
148
+ nodes : [
149
+ {
150
+ kind : 'value' ,
151
+ value : '1' ,
152
+ } ,
153
+ ] ,
154
+ } ,
155
+ ] ,
156
+ } ,
157
+ ] )
158
+ } )
80
159
} )
81
160
82
161
describe ( 'toCss' , ( ) => {
Original file line number Diff line number Diff line change @@ -300,7 +300,11 @@ export function parse(input: string) {
300
300
buffer = ''
301
301
i = end
302
302
303
- ast . push ( node )
303
+ if ( parent ) {
304
+ parent . nodes . push ( node )
305
+ } else {
306
+ ast . push ( node )
307
+ }
304
308
305
309
break
306
310
}
You can’t perform that action at this time.
0 commit comments