mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
chore: remove code for non-supported :slotted feature
This commit is contained in:
parent
52cf912d85
commit
769c053cff
@ -81,8 +81,7 @@ function processRule(id: string, rule: Rule) {
|
||||
function rewriteSelector(
|
||||
id: string,
|
||||
selector: selectorParser.Selector,
|
||||
selectorRoot: selectorParser.Root,
|
||||
slotted = false
|
||||
selectorRoot: selectorParser.Root
|
||||
) {
|
||||
let node: selectorParser.Node | null = null
|
||||
let shouldInject = true
|
||||
@ -142,23 +141,22 @@ function rewriteSelector(
|
||||
return false
|
||||
}
|
||||
|
||||
// slot: use selector inside `::v-slotted` and inject [id + '-s']
|
||||
// instead.
|
||||
// !!! Vue 2 does not have :slotted support
|
||||
// ::v-slotted(.foo) -> .foo[xxxxxxx-s]
|
||||
if (value === ':slotted' || value === '::v-slotted') {
|
||||
rewriteSelector(id, n.nodes[0], selectorRoot, true /* slotted */)
|
||||
let last: selectorParser.Selector['nodes'][0] = n
|
||||
n.nodes[0].each(ss => {
|
||||
selector.insertAfter(last, ss)
|
||||
last = ss
|
||||
})
|
||||
// selector.insertAfter(n, n.nodes[0])
|
||||
selector.removeChild(n)
|
||||
// since slotted attribute already scopes the selector there's no
|
||||
// need for the non-slot attribute.
|
||||
shouldInject = false
|
||||
return false
|
||||
}
|
||||
// if (value === ':slotted' || value === '::v-slotted') {
|
||||
// rewriteSelector(id, n.nodes[0], selectorRoot, true /* slotted */)
|
||||
// let last: selectorParser.Selector['nodes'][0] = n
|
||||
// n.nodes[0].each(ss => {
|
||||
// selector.insertAfter(last, ss)
|
||||
// last = ss
|
||||
// })
|
||||
// // selector.insertAfter(n, n.nodes[0])
|
||||
// selector.removeChild(n)
|
||||
// // since slotted attribute already scopes the selector there's no
|
||||
// // need for the non-slot attribute.
|
||||
// shouldInject = false
|
||||
// return false
|
||||
// }
|
||||
|
||||
// global: replace with inner selector and do not inject [id].
|
||||
// ::v-global(.foo) -> .foo
|
||||
@ -184,14 +182,13 @@ function rewriteSelector(
|
||||
}
|
||||
|
||||
if (shouldInject) {
|
||||
const idToAdd = slotted ? id + '-s' : id
|
||||
selector.insertAfter(
|
||||
// If node is null it means we need to inject [id] at the start
|
||||
// insertAfter can handle `null` here
|
||||
node as any,
|
||||
selectorParser.attribute({
|
||||
attribute: idToAdd,
|
||||
value: idToAdd,
|
||||
attribute: id,
|
||||
value: id,
|
||||
raws: {},
|
||||
quoteMark: `"`
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user