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
2020- Ensure ` @reference "…" ` does not emit CSS variables ([ #16774 ] ( https://github.com/tailwindlabs/tailwindcss/pull/16774 ) )
2121- Fix an issue where ` @reference "…" ` would sometimes omit keyframe animations ([ #16774 ] ( https://github.com/tailwindlabs/tailwindcss/pull/16774 ) )
2222- 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
2324
2425## [ 4.0.8] - 2025-02-21
2526
Original file line number Diff line number Diff line change @@ -77,6 +77,85 @@ describe('parse', () => {
7777 } ,
7878 ] )
7979 } )
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+ } )
80159} )
81160
82161describe ( 'toCss' , ( ) => {
Original file line number Diff line number Diff line change @@ -300,7 +300,11 @@ export function parse(input: string) {
300300 buffer = ''
301301 i = end
302302
303- ast . push ( node )
303+ if ( parent ) {
304+ parent . nodes . push ( node )
305+ } else {
306+ ast . push ( node )
307+ }
304308
305309 break
306310 }
You can’t perform that action at this time.
0 commit comments