processSlotContent() — vue Function Reference
Architecture documentation for the processSlotContent() function in index.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 5b174fba_1f83_94cc_774e_5234231c01dc["processSlotContent()"] 31f9edc3_10e5_9556_86c6_7c900b922f60["processElement()"] 31f9edc3_10e5_9556_86c6_7c900b922f60 -->|calls| 5b174fba_1f83_94cc_774e_5234231c01dc b54f5bfb_1a4e_430d_f7d5_41f81c9a1ab3["getAndRemoveAttr()"] 5b174fba_1f83_94cc_774e_5234231c01dc -->|calls| b54f5bfb_1a4e_430d_f7d5_41f81c9a1ab3 2e03f8d2_4a5a_f1cd_1d7b_db95ba63549e["getBindingAttr()"] 5b174fba_1f83_94cc_774e_5234231c01dc -->|calls| 2e03f8d2_4a5a_f1cd_1d7b_db95ba63549e a5568283_0566_a9dd_887d_0985c4097fee["addAttr()"] 5b174fba_1f83_94cc_774e_5234231c01dc -->|calls| a5568283_0566_a9dd_887d_0985c4097fee 03f2c56c_d011_12c3_4e53_66cf29e6eed1["getRawBindingAttr()"] 5b174fba_1f83_94cc_774e_5234231c01dc -->|calls| 03f2c56c_d011_12c3_4e53_66cf29e6eed1 e8aa202e_10c7_9aed_f281_2d65e3e65cef["getAndRemoveAttrByRegex()"] 5b174fba_1f83_94cc_774e_5234231c01dc -->|calls| e8aa202e_10c7_9aed_f281_2d65e3e65cef 4758469f_8c41_7c27_59d2_22a2dd635829["getSlotName()"] 5b174fba_1f83_94cc_774e_5234231c01dc -->|calls| 4758469f_8c41_7c27_59d2_22a2dd635829 61cd312b_0f3f_8048_b42c_85f0f4766ca8["createASTElement()"] 5b174fba_1f83_94cc_774e_5234231c01dc -->|calls| 61cd312b_0f3f_8048_b42c_85f0f4766ca8 style 5b174fba_1f83_94cc_774e_5234231c01dc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/compiler/parser/index.ts lines 617–730
function processSlotContent(el) {
let slotScope
if (el.tag === 'template') {
slotScope = getAndRemoveAttr(el, 'scope')
/* istanbul ignore if */
if (__DEV__ && slotScope) {
warn(
`the "scope" attribute for scoped slots have been deprecated and ` +
`replaced by "slot-scope" since 2.5. The new "slot-scope" attribute ` +
`can also be used on plain elements in addition to <template> to ` +
`denote scoped slots.`,
el.rawAttrsMap['scope'],
true
)
}
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope')
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
/* istanbul ignore if */
if (__DEV__ && el.attrsMap['v-for']) {
warn(
`Ambiguous combined usage of slot-scope and v-for on <${el.tag}> ` +
`(v-for takes higher priority). Use a wrapper <template> for the ` +
`scoped slot to make it clearer.`,
el.rawAttrsMap['slot-scope'],
true
)
}
el.slotScope = slotScope
}
// slot="xxx"
const slotTarget = getBindingAttr(el, 'slot')
if (slotTarget) {
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget
el.slotTargetDynamic = !!(
el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']
)
// preserve slot as an attribute for native shadow DOM compat
// only for non-scoped slots.
if (el.tag !== 'template' && !el.slotScope) {
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'))
}
}
// 2.6 v-slot syntax
if (process.env.NEW_SLOT_SYNTAX) {
if (el.tag === 'template') {
// v-slot on <template>
const slotBinding = getAndRemoveAttrByRegex(el, slotRE)
if (slotBinding) {
if (__DEV__) {
if (el.slotTarget || el.slotScope) {
warn(`Unexpected mixed usage of different slot syntaxes.`, el)
}
if (el.parent && !maybeComponent(el.parent)) {
warn(
`<template v-slot> can only appear at the root level inside ` +
`the receiving component`,
el
)
}
}
const { name, dynamic } = getSlotName(slotBinding)
el.slotTarget = name
el.slotTargetDynamic = dynamic
el.slotScope = slotBinding.value || emptySlotScopeToken // force it into a scoped slot for perf
}
} else {
// v-slot on component, denotes default slot
const slotBinding = getAndRemoveAttrByRegex(el, slotRE)
if (slotBinding) {
if (__DEV__) {
if (!maybeComponent(el)) {
warn(
`v-slot can only be used on components or <template>.`,
slotBinding
)
}
if (el.slotScope || el.slotTarget) {
warn(`Unexpected mixed usage of different slot syntaxes.`, el)
}
if (el.scopedSlots) {
warn(
`To avoid scope ambiguity, the default slot should also use ` +
`<template> syntax when there are other named slots.`,
slotBinding
)
}
}
// add the component's children to its default slot
const slots = el.scopedSlots || (el.scopedSlots = {})
const { name, dynamic } = getSlotName(slotBinding)
const slotContainer = (slots[name] = createASTElement(
'template',
[],
el
))
slotContainer.slotTarget = name
slotContainer.slotTargetDynamic = dynamic
slotContainer.children = el.children.filter((c: any) => {
if (!c.slotScope) {
c.parent = slotContainer
return true
}
})
slotContainer.slotScope = slotBinding.value || emptySlotScopeToken
// remove children as they are returned from scopedSlots now
el.children = []
// mark el non-plain so data gets generated
el.plain = false
}
}
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does processSlotContent() do?
processSlotContent() is a function in the vue codebase.
What does processSlotContent() call?
processSlotContent() calls 7 function(s): addAttr, createASTElement, getAndRemoveAttr, getAndRemoveAttrByRegex, getBindingAttr, getRawBindingAttr, getSlotName.
What calls processSlotContent()?
processSlotContent() is called by 1 function(s): processElement.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free