File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,45 @@ describe('SFC scoped CSS', () => {
161161 ` )
162162 } )
163163
164+ // #10511
165+ test ( ':is() and :where() in compound selectors' , ( ) => {
166+ expect (
167+ compileScoped ( `.div { color: red; } .div:where(:hover) { color: blue; }` ) ,
168+ ) . toMatchInlineSnapshot ( `
169+ ".div[data-v-test] { color: red;
170+ }
171+ .div[data-v-test]:where(:hover) { color: blue;
172+ }"` )
173+
174+ expect (
175+ compileScoped ( `.div { color: red; } .div:is(:hover) { color: blue; }` ) ,
176+ ) . toMatchInlineSnapshot ( `
177+ ".div[data-v-test] { color: red;
178+ }
179+ .div[data-v-test]:is(:hover) { color: blue;
180+ }"` )
181+
182+ expect (
183+ compileScoped (
184+ `.div { color: red; } .div:where(.foo:hover) { color: blue; }` ,
185+ ) ,
186+ ) . toMatchInlineSnapshot ( `
187+ ".div[data-v-test] { color: red;
188+ }
189+ .div[data-v-test]:where(.foo:hover) { color: blue;
190+ }"` )
191+
192+ expect (
193+ compileScoped (
194+ `.div { color: red; } .div:is(.foo:hover) { color: blue; }` ,
195+ ) ,
196+ ) . toMatchInlineSnapshot ( `
197+ ".div[data-v-test] { color: red;
198+ }
199+ .div[data-v-test]:is(.foo:hover) { color: blue;
200+ }"` )
201+ } )
202+
164203 test ( 'media query' , ( ) => {
165204 expect ( compileScoped ( `@media print { .foo { color: red }}` ) )
166205 . toMatchInlineSnapshot ( `
Original file line number Diff line number Diff line change @@ -172,7 +172,9 @@ function rewriteSelector(
172172
173173 if (
174174 ( n . type !== 'pseudo' && n . type !== 'combinator' ) ||
175- ( n . type === 'pseudo' && ( n . value === ':is' || n . value === ':where' ) )
175+ ( n . type === 'pseudo' &&
176+ ( n . value === ':is' || n . value === ':where' ) &&
177+ ! node )
176178 ) {
177179 node = n
178180 }
You can’t perform that action at this time.
0 commit comments