Skip to content

Commit fa45aa8

Browse files
committed
fix(MDCSlot): do not unwrap Comment nodes
1 parent d99e3b6 commit fa45aa8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/utils/node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { VNode } from 'vue'
1+
import { Comment, type VNode } from 'vue'
22
import type { MDCElement, MDCNode, MDCText } from '../types'
33

44
/**
@@ -117,7 +117,7 @@ function _flatUnwrap (vnodes: VNode | VNode[], tags = ['p']): Array<VNode> {
117117
export function flatUnwrap (vnodes: VNode | VNode[], tags = ['p']): Array<VNode | string> {
118118
return _flatUnwrap(vnodes, tags)
119119
.reduce((acc, item) => {
120-
if (typeof item.children === 'string') {
120+
if (typeof item.children === 'string' && item.type !== Comment) {
121121
if (typeof acc[acc.length - 1] === 'string') {
122122
acc[acc.length - 1] += item.children
123123
} else {

0 commit comments

Comments
 (0)