mirror of https://github.com/vuejs/core.git
chore: update
This commit is contained in:
parent
6f0f944d83
commit
bfd11af474
|
@ -146,6 +146,12 @@ color: red
|
||||||
&[data-v-test] .bar { color: red;
|
&[data-v-test] .bar { color: red;
|
||||||
}}"
|
}}"
|
||||||
`)
|
`)
|
||||||
|
expect(compileScoped(`.foo { :deep(.bar),:deep(.baz) { color: red; }}`))
|
||||||
|
.toMatchInlineSnapshot(`
|
||||||
|
".foo {
|
||||||
|
&[data-v-test] .bar,&[data-v-test] .baz { color: red;
|
||||||
|
}}"
|
||||||
|
`)
|
||||||
expect(compileScoped(`.foo { & :deep(.bar) { color: red; }}`))
|
expect(compileScoped(`.foo { & :deep(.bar) { color: red; }}`))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
".foo {
|
".foo {
|
||||||
|
|
|
@ -134,23 +134,16 @@ function rewriteSelector(
|
||||||
last = ss
|
last = ss
|
||||||
})
|
})
|
||||||
|
|
||||||
// if css nesting is used, we need to insert a nesting combinator
|
// if css nesting is used, we need to insert a nesting selector
|
||||||
// before the ::v-deep node
|
// before the ::v-deep's inner selector.
|
||||||
// .foo { ::v-deep(.bar) } -> .foo { &[xxxxxxx] .bar }
|
// .foo { ::v-deep(.bar) } -> .foo { &[xxxxxxx] .bar }
|
||||||
const isNestedRule = rule.parent && rule.parent.type === 'rule'
|
const isNestedRule = rule.parent && rule.parent.type === 'rule'
|
||||||
if (isNestedRule && n.parent) {
|
if (isNestedRule && n.parent) {
|
||||||
let hasNestingCombinator = false
|
const hasNestingSelector = n.parent.nodes
|
||||||
let index = n.parent.index(n) - 1
|
.slice(0, n.parent.index(n))
|
||||||
while (index >= 0) {
|
.some(node => node.type === 'nesting')
|
||||||
const prev = n.parent.at(index)
|
|
||||||
if (!prev) break
|
if (!hasNestingSelector) {
|
||||||
if (prev.type === 'nesting') {
|
|
||||||
hasNestingCombinator = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
index--
|
|
||||||
}
|
|
||||||
if (!hasNestingCombinator) {
|
|
||||||
node = selectorParser.nesting()
|
node = selectorParser.nesting()
|
||||||
selector.insertBefore(n, node)
|
selector.insertBefore(n, node)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue