@@ -3,20 +3,23 @@ import { Dynamic } from 'solid-js/web';
33
44export const Fragment = ( properties : PropsWithChildren ) : JSX . Element => properties . children ;
55
6- export const jsx = (
7- type : string | ( ( properties_ : PropsWithChildren ) => JSX . Element ) ,
8- properties : Record < string , unknown > & { children : JSX . Element }
9- ) : JSX . Element => {
6+ const getNewProperties = (
7+ properties : Record < string , unknown > & { children ?: JSX . Element }
8+ ) : PropsWithChildren => {
109 const newProperties : Record < string , unknown > = { } ;
11-
1210 for ( const key of Object . keys ( properties ) ) newProperties [ jsxKeyToSolid ( key ) ] = properties [ key ] ;
11+ return newProperties ;
12+ } ;
1313
14- return typeof type === 'function'
14+ export const jsx = (
15+ type : string | ( ( properties_ : PropsWithChildren ) => JSX . Element ) ,
16+ properties : PropsWithChildren
17+ ) : JSX . Element =>
18+ typeof type === 'function'
1519 ? type . name === 'Fragment'
1620 ? properties . children
17- : type ( newProperties )
18- : createComponent ( Dynamic , mergeProps ( newProperties , { component : type } ) ) ;
19- } ;
21+ : type ( getNewProperties ( properties ) )
22+ : createComponent ( Dynamic , mergeProps ( getNewProperties ( properties ) , { component : type } ) ) ;
2023
2124// For the moment we do not distinguish static children from dynamic ones
2225export const jsxs = jsx ;
@@ -34,6 +37,11 @@ const MAPPED_ATTRIBUTES = new Map([
3437 [ 'autoFocus' , 'autofocus' ] ,
3538 [ 'contentEditable' , 'contenteditable' ] ,
3639 [ 'noValidate' , 'novalidate' ] ,
40+ [ 'isMap' , 'ismap' ] ,
41+ [ 'playsInline' , 'playsinline' ] ,
42+ [ 'allowFullScreen' , 'allowfullscreen' ] ,
43+ [ 'formNoValidate' , 'formnovalidate' ] ,
44+ [ 'noModule' , 'nomodule' ] ,
3745] ) ;
3846
3947const jsxKeyToSolid = ( key : string ) : string =>
0 commit comments