MCPcopy
hub / github.com/fanmingming/live / processSlotContent

Function processSlotContent

m3u8/vue.js:10101–10218  ·  view source on GitHub ↗
(el)

Source from the content-addressed store, hash-verified

10099 // handle content being passed to a component as slot,
10100 // e.g. <template slot="xxx">, <div slot-scope="xxx">
10101 function processSlotContent (el) {
10102 var slotScope;
10103 if (el.tag === 'template') {
10104 slotScope = getAndRemoveAttr(el, 'scope');
10105 /* istanbul ignore if */
10106 if (slotScope) {
10107 warn$2(
10108 "the \"scope\" attribute for scoped slots have been deprecated and " +
10109 "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
10110 "can also be used on plain elements in addition to <template> to " +
10111 "denote scoped slots.",
10112 el.rawAttrsMap['scope'],
10113 true
10114 );
10115 }
10116 el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
10117 } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
10118 /* istanbul ignore if */
10119 if (el.attrsMap['v-for']) {
10120 warn$2(
10121 "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
10122 "(v-for takes higher priority). Use a wrapper <template> for the " +
10123 "scoped slot to make it clearer.",
10124 el.rawAttrsMap['slot-scope'],
10125 true
10126 );
10127 }
10128 el.slotScope = slotScope;
10129 }
10130
10131 // slot="xxx"
10132 var slotTarget = getBindingAttr(el, 'slot');
10133 if (slotTarget) {
10134 el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
10135 el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
10136 // preserve slot as an attribute for native shadow DOM compat
10137 // only for non-scoped slots.
10138 if (el.tag !== 'template' && !el.slotScope) {
10139 addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
10140 }
10141 }
10142
10143 // 2.6 v-slot syntax
10144 {
10145 if (el.tag === 'template') {
10146 // v-slot on <template>
10147 var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
10148 if (slotBinding) {
10149 {
10150 if (el.slotTarget || el.slotScope) {
10151 warn$2(
10152 "Unexpected mixed usage of different slot syntaxes.",
10153 el
10154 );
10155 }
10156 if (el.parent && !maybeComponent(el.parent)) {
10157 warn$2(
10158 "<template v-slot> can only appear at the root level inside " +

Callers 1

processElementFunction · 0.85

Calls 7

getAndRemoveAttrFunction · 0.85
getBindingAttrFunction · 0.85
addAttrFunction · 0.85
getRawBindingAttrFunction · 0.85
getAndRemoveAttrByRegexFunction · 0.85
getSlotNameFunction · 0.85
createASTElementFunction · 0.85

Tested by

no test coverage detected