(el)
| 13727 | |
| 13728 | //检查插槽作用域 为el虚拟dom添加 slotName或者slotScope或者slot |
| 13729 | function processSlot(el) { |
| 13730 | if (el.tag === 'slot') { //判断是否是slot插槽 |
| 13731 | el.slotName = getBindingAttr(el, 'name'); //获取插槽的name属性 |
| 13732 | //如果设置了key 则警告 |
| 13733 | if ("development" !== 'production' && el.key) { |
| 13734 | warn$2( |
| 13735 | "`key` does not work on <slot> because slots are abstract outlets " + |
| 13736 | "and can possibly expand into multiple elements. " + |
| 13737 | "Use the key on a wrapping element instead." |
| 13738 | ); |
| 13739 | } |
| 13740 | } else { |
| 13741 | var slotScope; |
| 13742 | if (el.tag === 'template') { //如果是模板标签 |
| 13743 | slotScope = getAndRemoveAttr(el, 'scope'); //获取scope属性值 |
| 13744 | /* istanbul ignore if */ |
| 13745 | if ("development" !== 'production' && slotScope) { |
| 13746 | warn$2( |
| 13747 | "the \"scope\" attribute for scoped slots have been deprecated and " + |
| 13748 | "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " + |
| 13749 | "can also be used on plain elements in addition to <template> to " + |
| 13750 | "denote scoped slots.", |
| 13751 | true |
| 13752 | ); |
| 13753 | } |
| 13754 | el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope'); //添加slotScope 的作用域 |
| 13755 | |
| 13756 | } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) { //获取slot-scope 作用域属性 |
| 13757 | /* istanbul ignore if */ |
| 13758 | if ("development" !== 'production' && el.attrsMap['v-for']) { |
| 13759 | warn$2( |
| 13760 | "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " + |
| 13761 | "(v-for takes higher priority). Use a wrapper <template> for the " + |
| 13762 | "scoped slot to make it clearer.", |
| 13763 | true |
| 13764 | ); |
| 13765 | } |
| 13766 | el.slotScope = slotScope;//添加slotScope 的作用域 |
| 13767 | } |
| 13768 | |
| 13769 | |
| 13770 | var slotTarget = getBindingAttr(el, 'slot'); //获取slot 属性 |
| 13771 | if (slotTarget) { |
| 13772 | el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget; |
| 13773 | // preserve slot as an attribute for native shadow DOM compat |
| 13774 | // only for non-scoped slots. |
| 13775 | //保留slot作为本地影子DOM compat的属性 |
| 13776 | //只适用于非作用域插槽。 |
| 13777 | if (el.tag !== 'template' && !el.slotScope) { |
| 13778 | //添加插槽属性 |
| 13779 | addAttr(el, 'slot', slotTarget); |
| 13780 | } |
| 13781 | } |
| 13782 | } |
| 13783 | } |
| 13784 | |
| 13785 | // 判断虚拟dom 是否有 :is属性,是否有inline-template 内联模板属性 如果有则标记下 为el 虚拟dom 添加component属性或者inlineTemplate 标志 |
| 13786 | function processComponent(el) { |
no test coverage detected