Skip to content

Commit 184da1a

Browse files
committed
chore: update
1 parent 6f0f944 commit 184da1a

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

packages/compiler-sfc/src/style/pluginScoped.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,10 @@ function rewriteSelector(
139139
// .foo { ::v-deep(.bar) } -> .foo { &[xxxxxxx] .bar }
140140
const isNestedRule = rule.parent && rule.parent.type === 'rule'
141141
if (isNestedRule && n.parent) {
142-
let hasNestingCombinator = false
143-
let index = n.parent.index(n) - 1
144-
while (index >= 0) {
145-
const prev = n.parent.at(index)
146-
if (!prev) break
147-
if (prev.type === 'nesting') {
148-
hasNestingCombinator = true
149-
break
150-
}
151-
index--
152-
}
142+
const hasNestingCombinator = n.parent.nodes
143+
.slice(0, n.parent.index(n))
144+
.some(node => node.type === 'nesting')
145+
153146
if (!hasNestingCombinator) {
154147
node = selectorParser.nesting()
155148
selector.insertBefore(n, node)

0 commit comments

Comments
 (0)