@@ -81,8 +81,7 @@ function processRule(id: string, rule: Rule) {
81
81
function rewriteSelector (
82
82
id : string ,
83
83
selector : selectorParser . Selector ,
84
- selectorRoot : selectorParser . Root ,
85
- slotted = false
84
+ selectorRoot : selectorParser . Root
86
85
) {
87
86
let node : selectorParser . Node | null = null
88
87
let shouldInject = true
@@ -142,23 +141,22 @@ function rewriteSelector(
142
141
return false
143
142
}
144
143
145
- // slot: use selector inside `::v-slotted` and inject [id + '-s']
146
- // instead.
144
+ // !!! Vue 2 does not have :slotted support
147
145
// ::v-slotted(.foo) -> .foo[xxxxxxx-s]
148
- if ( value === ':slotted' || value === '::v-slotted' ) {
149
- rewriteSelector ( id , n . nodes [ 0 ] , selectorRoot , true /* slotted */ )
150
- let last : selectorParser . Selector [ 'nodes' ] [ 0 ] = n
151
- n . nodes [ 0 ] . each ( ss => {
152
- selector . insertAfter ( last , ss )
153
- last = ss
154
- } )
155
- // selector.insertAfter(n, n.nodes[0])
156
- selector . removeChild ( n )
157
- // since slotted attribute already scopes the selector there's no
158
- // need for the non-slot attribute.
159
- shouldInject = false
160
- return false
161
- }
146
+ // if (value === ':slotted' || value === '::v-slotted') {
147
+ // rewriteSelector(id, n.nodes[0], selectorRoot, true /* slotted */)
148
+ // let last: selectorParser.Selector['nodes'][0] = n
149
+ // n.nodes[0].each(ss => {
150
+ // selector.insertAfter(last, ss)
151
+ // last = ss
152
+ // })
153
+ // // selector.insertAfter(n, n.nodes[0])
154
+ // selector.removeChild(n)
155
+ // // since slotted attribute already scopes the selector there's no
156
+ // // need for the non-slot attribute.
157
+ // shouldInject = false
158
+ // return false
159
+ // }
162
160
163
161
// global: replace with inner selector and do not inject [id].
164
162
// ::v-global(.foo) -> .foo
@@ -184,14 +182,13 @@ function rewriteSelector(
184
182
}
185
183
186
184
if ( shouldInject ) {
187
- const idToAdd = slotted ? id + '-s' : id
188
185
selector . insertAfter (
189
186
// If node is null it means we need to inject [id] at the start
190
187
// insertAfter can handle `null` here
191
188
node as any ,
192
189
selectorParser . attribute ( {
193
- attribute : idToAdd ,
194
- value : idToAdd ,
190
+ attribute : id ,
191
+ value : id ,
195
192
raws : { } ,
196
193
quoteMark : `"`
197
194
} )
0 commit comments