Home / Function/ processSlotContent() — vue Function Reference

processSlotContent() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  b1c7f848_3443_6284_06d1_dfc620ebd2c4["processSlotContent()"]
  320ee0f4_351d_a6b2_1c1c_f0f6f42fb987["index.ts"]
  b1c7f848_3443_6284_06d1_dfc620ebd2c4 -->|defined in| 320ee0f4_351d_a6b2_1c1c_f0f6f42fb987
  d580ca1c_dbf7_89f2_e0e4_6199ea988b51["processElement()"]
  d580ca1c_dbf7_89f2_e0e4_6199ea988b51 -->|calls| b1c7f848_3443_6284_06d1_dfc620ebd2c4
  0e57bf03_ee68_ffda_8b31_3f2c14b445a6["getAndRemoveAttr()"]
  b1c7f848_3443_6284_06d1_dfc620ebd2c4 -->|calls| 0e57bf03_ee68_ffda_8b31_3f2c14b445a6
  4ed4ecb1_33ab_6e92_8439_f0a81ee997fa["getBindingAttr()"]
  b1c7f848_3443_6284_06d1_dfc620ebd2c4 -->|calls| 4ed4ecb1_33ab_6e92_8439_f0a81ee997fa
  51133883_ca33_6568_1819_239e506a3448["addAttr()"]
  b1c7f848_3443_6284_06d1_dfc620ebd2c4 -->|calls| 51133883_ca33_6568_1819_239e506a3448
  12285829_a55a_4d30_e33b_0f5f353d570a["getRawBindingAttr()"]
  b1c7f848_3443_6284_06d1_dfc620ebd2c4 -->|calls| 12285829_a55a_4d30_e33b_0f5f353d570a
  1e32c855_8301_1401_26b6_bb71382c4130["getAndRemoveAttrByRegex()"]
  b1c7f848_3443_6284_06d1_dfc620ebd2c4 -->|calls| 1e32c855_8301_1401_26b6_bb71382c4130
  a557503a_47cd_7de8_d877_9b2de980e37a["getSlotName()"]
  b1c7f848_3443_6284_06d1_dfc620ebd2c4 -->|calls| a557503a_47cd_7de8_d877_9b2de980e37a
  fc56981f_9001_955c_5e6d_6ea55122787e["createASTElement()"]
  b1c7f848_3443_6284_06d1_dfc620ebd2c4 -->|calls| fc56981f_9001_955c_5e6d_6ea55122787e
  style b1c7f848_3443_6284_06d1_dfc620ebd2c4 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