Home / Function/ processSlotContent() — vue Function Reference

processSlotContent() — vue Function Reference

Architecture documentation for the processSlotContent() function in index.ts from the vue codebase.

Function typescript VueCore GlobalAPI calls 7 called by 1

Entity Profile

Dependency Diagram

graph TD
  0fe86055_18c1_a749_5110_c7eddeeef79e["processSlotContent()"]
  101d3d34_ac07_228f_62b9_5d5ac4a0ea2e["index.ts"]
  0fe86055_18c1_a749_5110_c7eddeeef79e -->|defined in| 101d3d34_ac07_228f_62b9_5d5ac4a0ea2e
  08093d1f_a003_dbad_063e_2431482be94f["processElement()"]
  08093d1f_a003_dbad_063e_2431482be94f -->|calls| 0fe86055_18c1_a749_5110_c7eddeeef79e
  4f0d956c_7641_b36d_a23d_3803fa58d311["getAndRemoveAttr()"]
  0fe86055_18c1_a749_5110_c7eddeeef79e -->|calls| 4f0d956c_7641_b36d_a23d_3803fa58d311
  58594d31_46d6_b10c_c378_911111359052["getBindingAttr()"]
  0fe86055_18c1_a749_5110_c7eddeeef79e -->|calls| 58594d31_46d6_b10c_c378_911111359052
  728112a4_3e04_adaf_9ed8_659dd3281218["addAttr()"]
  0fe86055_18c1_a749_5110_c7eddeeef79e -->|calls| 728112a4_3e04_adaf_9ed8_659dd3281218
  f53a6d5d_35db_c75d_12ae_df402776a846["getRawBindingAttr()"]
  0fe86055_18c1_a749_5110_c7eddeeef79e -->|calls| f53a6d5d_35db_c75d_12ae_df402776a846
  ea90c896_7664_f4a3_6591_5f86d5fe6ed6["getAndRemoveAttrByRegex()"]
  0fe86055_18c1_a749_5110_c7eddeeef79e -->|calls| ea90c896_7664_f4a3_6591_5f86d5fe6ed6
  2c85c13e_74a7_e9e4_fae5_f29d584e3acf["getSlotName()"]
  0fe86055_18c1_a749_5110_c7eddeeef79e -->|calls| 2c85c13e_74a7_e9e4_fae5_f29d584e3acf
  4e75c3e7_0ca3_e8e1_4b44_838fc9982387["createASTElement()"]
  0fe86055_18c1_a749_5110_c7eddeeef79e -->|calls| 4e75c3e7_0ca3_e8e1_4b44_838fc9982387
  style 0fe86055_18c1_a749_5110_c7eddeeef79e 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)
          }

Domain

Subdomains

Called By

Frequently Asked Questions

What does processSlotContent() do?
processSlotContent() is a function in the vue codebase, defined in src/compiler/parser/index.ts.
Where is processSlotContent() defined?
processSlotContent() is defined in src/compiler/parser/index.ts at line 617.
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