MCPcopy
hub / github.com/vuejs/core / splitSelectorForNestedDeep

Function splitSelectorForNestedDeep

packages/compiler-sfc/src/style/pluginScoped.ts:378–406  ·  view source on GitHub ↗
(
  id: string,
  rule: Rule,
  selector: selectorParser.Selector,
  selectorRoot: selectorParser.Root,
  pseudo: selectorParser.Pseudo,
  deep: boolean,
  slotted: boolean,
)

Source from the content-addressed store, hash-verified

376}
377
378function splitSelectorForNestedDeep(
379 id: string,
380 rule: Rule,
381 selector: selectorParser.Selector,
382 selectorRoot: selectorParser.Root,
383 pseudo: selectorParser.Pseudo,
384 deep: boolean,
385 slotted: boolean,
386) {
387 const pseudoIndex = selector.index(pseudo)
388 const selectors = pseudo.nodes.map((branch, index) => {
389 const branchSelector = selector.clone()
390 if (branchSelector.first) {
391 branchSelector.first.spaces.before =
392 index === 0 ? selector.first.spaces.before : ' '
393 }
394 const branchPseudo = branchSelector.at(pseudoIndex) as selectorParser.Pseudo
395 const branchClone = branch.clone()
396 if (branchClone.first) {
397 branchClone.first.spaces.before = ''
398 }
399 branchPseudo.removeAll()
400 branchPseudo.append(branchClone)
401 rewriteSelector(id, rule, branchSelector, selectorRoot, deep, slotted)
402 return branchSelector
403 })
404
405 selector.replaceWith(...selectors)
406}
407
408function extractAndWrapNodes(parentNode: Rule | AtRule) {
409 if (!parentNode.nodes) return

Callers 1

rewriteSelectorFunction · 0.85

Calls 3

rewriteSelectorFunction · 0.85
mapMethod · 0.80
cloneMethod · 0.80

Tested by

no test coverage detected