mirror of https://github.com/vuejs/core.git
Revert "fix(compiler-sfc): add scoping tag to trailing universal selector (#1…" (#13406)
This reverts commit 949df80880
.
This commit is contained in:
parent
d9bd436b1a
commit
19f23b180b
|
@ -493,31 +493,7 @@ describe('SFC style preprocessors', () => {
|
||||||
}"
|
}"
|
||||||
`)
|
`)
|
||||||
expect(compileScoped(`.foo * { color: red; }`)).toMatchInlineSnapshot(`
|
expect(compileScoped(`.foo * { color: red; }`)).toMatchInlineSnapshot(`
|
||||||
".foo[data-v-test] [data-v-test] { color: red;
|
".foo[data-v-test] * { color: red;
|
||||||
}"
|
|
||||||
`)
|
|
||||||
expect(compileScoped(`.foo :active { color: red; }`))
|
|
||||||
.toMatchInlineSnapshot(`
|
|
||||||
".foo[data-v-test] :active { color: red;
|
|
||||||
}"
|
|
||||||
`)
|
|
||||||
expect(compileScoped(`.foo *:active { color: red; }`))
|
|
||||||
.toMatchInlineSnapshot(`
|
|
||||||
".foo[data-v-test] [data-v-test]:active { color: red;
|
|
||||||
}"
|
|
||||||
`)
|
|
||||||
expect(compileScoped(`.foo * .bar { color: red; }`)).toMatchInlineSnapshot(`
|
|
||||||
".foo * .bar[data-v-test] { color: red;
|
|
||||||
}"
|
|
||||||
`)
|
|
||||||
expect(compileScoped(`:last-child * { color: red; }`))
|
|
||||||
.toMatchInlineSnapshot(`
|
|
||||||
"[data-v-test]:last-child [data-v-test] { color: red;
|
|
||||||
}"
|
|
||||||
`)
|
|
||||||
expect(compileScoped(`:last-child *:active { color: red; }`))
|
|
||||||
.toMatchInlineSnapshot(`
|
|
||||||
"[data-v-test]:last-child [data-v-test]:active { color: red;
|
|
||||||
}"
|
}"
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
|
|
|
@ -102,7 +102,6 @@ function rewriteSelector(
|
||||||
slotted = false,
|
slotted = false,
|
||||||
) {
|
) {
|
||||||
let node: selectorParser.Node | null = null
|
let node: selectorParser.Node | null = null
|
||||||
let starNode: selectorParser.Node | null = null
|
|
||||||
let shouldInject = !deep
|
let shouldInject = !deep
|
||||||
// find the last child node to insert attribute selector
|
// find the last child node to insert attribute selector
|
||||||
selector.each(n => {
|
selector.each(n => {
|
||||||
|
@ -217,21 +216,17 @@ function rewriteSelector(
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// store the universal selector so it can be rewritten later
|
// .foo * -> .foo[xxxxxxx] *
|
||||||
// .foo * -> .foo[xxxxxxx] [xxxxxxx]
|
if (node) return
|
||||||
starNode = n
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(n.type !== 'pseudo' &&
|
(n.type !== 'pseudo' && n.type !== 'combinator') ||
|
||||||
n.type !== 'combinator' &&
|
|
||||||
n.type !== 'universal') ||
|
|
||||||
(n.type === 'pseudo' &&
|
(n.type === 'pseudo' &&
|
||||||
(n.value === ':is' || n.value === ':where') &&
|
(n.value === ':is' || n.value === ':where') &&
|
||||||
!node)
|
!node)
|
||||||
) {
|
) {
|
||||||
node = n
|
node = n
|
||||||
starNode = null
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -279,20 +274,6 @@ function rewriteSelector(
|
||||||
quoteMark: `"`,
|
quoteMark: `"`,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
// Used for trailing universal selectors (#12906)
|
|
||||||
// `.foo * {}` -> `.foo[xxxxxxx] [xxxxxxx] {}`
|
|
||||||
if (starNode) {
|
|
||||||
selector.insertBefore(
|
|
||||||
starNode,
|
|
||||||
selectorParser.attribute({
|
|
||||||
attribute: idToAdd,
|
|
||||||
value: idToAdd,
|
|
||||||
raws: {},
|
|
||||||
quoteMark: `"`,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
selector.removeChild(starNode)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue