mirror of https://github.com/vuejs/core.git
fix(compiler-sfc): support `:is` and `:where` selector in scoped css rewrite (#8929)
This commit is contained in:
parent
fe82f96376
commit
c6083dcad3
|
@ -85,6 +85,16 @@ describe('SFC scoped CSS', () => {
|
||||||
".baz .qux[data-v-test] .foo .bar { color: red;
|
".baz .qux[data-v-test] .foo .bar { color: red;
|
||||||
}"
|
}"
|
||||||
`)
|
`)
|
||||||
|
expect(compileScoped(`:is(.foo :deep(.bar)) { color: red; }`))
|
||||||
|
.toMatchInlineSnapshot(`
|
||||||
|
":is(.foo[data-v-test] .bar) { color: red;
|
||||||
|
}"
|
||||||
|
`)
|
||||||
|
expect(compileScoped(`:where(.foo :deep(.bar)) { color: red; }`))
|
||||||
|
.toMatchInlineSnapshot(`
|
||||||
|
":where(.foo[data-v-test] .bar) { color: red;
|
||||||
|
}"
|
||||||
|
`)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('::v-slotted', () => {
|
test('::v-slotted', () => {
|
||||||
|
|
|
@ -173,6 +173,11 @@ function rewriteSelector(
|
||||||
if (n.type !== 'pseudo' && n.type !== 'combinator') {
|
if (n.type !== 'pseudo' && n.type !== 'combinator') {
|
||||||
node = n
|
node = n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (n.type === 'pseudo' && (n.value === ':is' || n.value === ':where')) {
|
||||||
|
rewriteSelector(id, n.nodes[0], selectorRoot, slotted)
|
||||||
|
shouldInject = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
|
|
Loading…
Reference in New Issue