Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jovyntls committed Mar 17, 2023
1 parent 12eae43 commit 2e15a42
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/core/src/html/vueSlotSyntaxProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ export function shiftSlotNodeDeeper(node: MbNode) {
nodeChildren.forEach((child) => {
const vslotShorthandName = getVslotShorthandName(child);
if (vslotShorthandName && child.name !== 'template') {
const newSlotNode = parseHTML('<template></template>')[0];
const newSlotNode = parseHTML('<template></template>')[0] as MbNode;

const vslotShorthand = `#${vslotShorthandName}`;

newSlotNode.attribs = newSlotNode.attribs ?? {};
newSlotNode.attribs[vslotShorthand] = '';
if (child.attribs) {
delete child.attribs[vslotShorthand];
Expand All @@ -43,7 +42,7 @@ export function shiftSlotNodeDeeper(node: MbNode) {
newSlotNode.parent = node;
child.parent = newSlotNode;

newSlotNode.children = newSlotNode?.children ?? [];
newSlotNode.children = newSlotNode.children ?? [];
newSlotNode.children.push(child);

// replace the shifted old child node with the new slot node
Expand Down

0 comments on commit 2e15a42

Please sign in to comment.