@vue/language-core
Advanced tools
@@ -49,3 +49,2 @@ "use strict"; | ||
| if (isComponent) { | ||
| let hasTemplateSlots = false; | ||
| let hasNamedDefaultSlot = false; | ||
@@ -55,3 +54,11 @@ const implicitDefaultChildren = []; | ||
| const onComponentSlot = (0, compiler_dom_1.findDir)(node, 'slot', true); | ||
| for (const child of node.children) { | ||
| for (let child of node.children) { | ||
| // <template v-for> -> for > template | ||
| if (child.type === compiler_dom_1.NodeTypes.FOR) { | ||
| child = child.children[0]; | ||
| } | ||
| // <template v-if> -> if > branch > template | ||
| else if (child.type === compiler_dom_1.NodeTypes.IF) { | ||
| child = child.branches[0].children[0]; | ||
| } | ||
| let slotDir; | ||
@@ -68,6 +75,2 @@ if (!(0, compiler_dom_1.isTemplateNode)(child) || !(slotDir = (0, compiler_dom_1.findDir)(child, 'slot', true))) { | ||
| } | ||
| if ((0, compiler_dom_1.findDir)(child, /^(?:if|else-if|else|for)$/, true)) { | ||
| continue; | ||
| } | ||
| hasTemplateSlots = true; | ||
| const staticSlotName = slotDir.arg | ||
@@ -89,3 +92,3 @@ ? (0, compiler_dom_1.isStaticExp)(slotDir.arg) | ||
| } | ||
| if (hasTemplateSlots && hasNamedDefaultSlot | ||
| if (hasNamedDefaultSlot | ||
| && implicitDefaultChildren.some(node => node.type !== compiler_dom_1.NodeTypes.TEXT || !!node.content.trim())) { | ||
@@ -92,0 +95,0 @@ context.onError((0, compiler_dom_1.createCompilerError)(compiler_dom_1.ErrorCodes.X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN, implicitDefaultChildren[0].loc)); |
+2
-2
| { | ||
| "name": "@vue/language-core", | ||
| "version": "3.3.0", | ||
| "version": "3.3.1", | ||
| "license": "MIT", | ||
@@ -37,3 +37,3 @@ "files": [ | ||
| }, | ||
| "gitHead": "1088dce8ae6b937f7525fae4982e3b3ea99d3c64" | ||
| "gitHead": "9109bf31282c3d92ca0dd1825b0872a59b572b84" | ||
| } |
391920
0.04%8987
0.03%