File tree Expand file tree Collapse file tree 2 files changed +4
-47
lines changed Expand file tree Collapse file tree 2 files changed +4
-47
lines changed Original file line number Diff line number Diff line change @@ -493,31 +493,7 @@ describe('SFC style preprocessors', () => {
493493 }"
494494 ` )
495495 expect ( compileScoped ( `.foo * { color: red; }` ) ) . toMatchInlineSnapshot ( `
496- ".foo[data-v-test] [data-v-test] { color: red;
497- }"
498- ` )
499- expect ( compileScoped ( `.foo :active { color: red; }` ) )
500- . toMatchInlineSnapshot ( `
501- ".foo[data-v-test] :active { color: red;
502- }"
503- ` )
504- expect ( compileScoped ( `.foo *:active { color: red; }` ) )
505- . toMatchInlineSnapshot ( `
506- ".foo[data-v-test] [data-v-test]:active { color: red;
507- }"
508- ` )
509- expect ( compileScoped ( `.foo * .bar { color: red; }` ) ) . toMatchInlineSnapshot ( `
510- ".foo * .bar[data-v-test] { color: red;
511- }"
512- ` )
513- expect ( compileScoped ( `:last-child * { color: red; }` ) )
514- . toMatchInlineSnapshot ( `
515- "[data-v-test]:last-child [data-v-test] { color: red;
516- }"
517- ` )
518- expect ( compileScoped ( `:last-child *:active { color: red; }` ) )
519- . toMatchInlineSnapshot ( `
520- "[data-v-test]:last-child [data-v-test]:active { color: red;
496+ ".foo[data-v-test] * { color: red;
521497 }"
522498 ` )
523499 } )
Original file line number Diff line number Diff line change @@ -102,7 +102,6 @@ function rewriteSelector(
102102 slotted = false ,
103103) {
104104 let node : selectorParser . Node | null = null
105- let starNode : selectorParser . Node | null = null
106105 let shouldInject = ! deep
107106 // find the last child node to insert attribute selector
108107 selector . each ( n => {
@@ -217,21 +216,17 @@ function rewriteSelector(
217216 return false
218217 }
219218 }
220- // store the universal selector so it can be rewritten later
221- // .foo * -> .foo[xxxxxxx] [xxxxxxx]
222- starNode = n
219+ // .foo * -> .foo[xxxxxxx] *
220+ if ( node ) return
223221 }
224222
225223 if (
226- ( n . type !== 'pseudo' &&
227- n . type !== 'combinator' &&
228- n . type !== 'universal' ) ||
224+ ( n . type !== 'pseudo' && n . type !== 'combinator' ) ||
229225 ( n . type === 'pseudo' &&
230226 ( n . value === ':is' || n . value === ':where' ) &&
231227 ! node )
232228 ) {
233229 node = n
234- starNode = null
235230 }
236231 } )
237232
@@ -279,20 +274,6 @@ function rewriteSelector(
279274 quoteMark : `"` ,
280275 } ) ,
281276 )
282- // Used for trailing universal selectors (#12906)
283- // `.foo * {}` -> `.foo[xxxxxxx] [xxxxxxx] {}`
284- if ( starNode ) {
285- selector . insertBefore (
286- starNode ,
287- selectorParser . attribute ( {
288- attribute : idToAdd ,
289- value : idToAdd ,
290- raws : { } ,
291- quoteMark : `"` ,
292- } ) ,
293- )
294- selector . removeChild ( starNode )
295- }
296277 }
297278}
298279
You can’t perform that action at this time.
0 commit comments