@@ -10,9 +10,10 @@ import {
1010 On ,
1111 VNodeData ,
1212 VNode ,
13- JsxVNodeChild ,
13+ JsxVNodeChildren ,
1414 Fragment ,
15- jsx ,
15+ vnode ,
16+ h ,
1617 init ,
1718 attributesModule ,
1819 propsModule ,
@@ -107,14 +108,36 @@ function splitProps(tagName: string, raw: VDOMData) {
107108export function createCell (
108109 tag : ComponentTag ,
109110 props : VDOMData = { } ,
110- ...defaultSlot : JsxVNodeChild [ ]
111+ ...children : JsxVNodeChildren [ ]
111112) {
113+ var defaultSlot : ( VNode | string ) [ ] = children
114+ . flat ( )
115+ . filter ( node => node != null && node !== false && node !== '' )
116+ . map ( node =>
117+ typeof node === 'boolean' ||
118+ typeof node === 'number' ||
119+ typeof node === 'string'
120+ ? vnode (
121+ undefined ,
122+ undefined ,
123+ undefined ,
124+ String ( node ) ,
125+ undefined
126+ )
127+ : node
128+ ) ;
129+ if ( defaultSlot . length === 1 && typeof defaultSlot [ 0 ] !== 'string' ) {
130+ const [ { sel, text } ] = defaultSlot ;
131+
132+ if ( ! sel && text ) defaultSlot = [ text ] ;
133+ }
134+
112135 if ( isHTMLElementClass ( tag ) ) tag = tagNameOf ( tag ) ;
113136 else if ( tag === Fragment )
114137 return Fragment ( { key : props ?. key } , ...defaultSlot ) ;
115138 else if ( typeof tag === 'function' ) return tag ( { ...props , defaultSlot } ) ;
116139
117- return jsx ( tag , splitProps ( tag , props ) , defaultSlot ) ;
140+ return h ( tag , splitProps ( tag , props ) , defaultSlot ) ;
118141}
119142
120143export function renderToStaticMarkup ( tree : VNode ) {
0 commit comments