chore: only set slotted flag on sfc descriptor if style is scoped
This commit is contained in:
parent
ff4d4ec249
commit
540e26f49c
@ -177,12 +177,14 @@ h1 { color: red }
|
|||||||
.slotted
|
.slotted
|
||||||
).toBe(false)
|
).toBe(false)
|
||||||
expect(
|
expect(
|
||||||
parse(`<template>hi</template><style>:slotted(h1){color:red;}</style>`)
|
parse(
|
||||||
.descriptor.slotted
|
`<template>hi</template><style scoped>:slotted(h1){color:red;}</style>`
|
||||||
|
).descriptor.slotted
|
||||||
).toBe(true)
|
).toBe(true)
|
||||||
expect(
|
expect(
|
||||||
parse(`<template>hi</template><style>::v-slotted(h1){color:red;}</style>`)
|
parse(
|
||||||
.descriptor.slotted
|
`<template>hi</template><style scoped>::v-slotted(h1){color:red;}</style>`
|
||||||
|
).descriptor.slotted
|
||||||
).toBe(true)
|
).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -237,7 +237,9 @@ export function parse(
|
|||||||
|
|
||||||
// check if the SFC uses :slotted
|
// check if the SFC uses :slotted
|
||||||
const slottedRE = /(?:::v-|:)slotted\(/
|
const slottedRE = /(?:::v-|:)slotted\(/
|
||||||
descriptor.slotted = descriptor.styles.some(s => slottedRE.test(s.content))
|
descriptor.slotted = descriptor.styles.some(
|
||||||
|
s => s.scoped && slottedRE.test(s.content)
|
||||||
|
)
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
descriptor,
|
descriptor,
|
||||||
|
Loading…
Reference in New Issue
Block a user