File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,20 @@ export function createElement(node: VNode | VNode[]): Node {
27
27
// set the attributes of the dom node
28
28
const attributes = node . attributes ;
29
29
for ( const key in attributes ) {
30
+ const value = attributes [ key ] ;
30
31
if ( key . startsWith ( "on" ) ) {
31
32
const eventName = key . slice ( 2 ) . toLowerCase ( ) ;
32
- el . addEventListener ( eventName , attributes [ key ] ) ;
33
+ el . addEventListener ( eventName , value ) ;
34
+ }
35
+ if ( key === "style" ) {
36
+ for ( const styleKey of value ) {
37
+ const styleValue = value [ styleKey ] ;
38
+ ( el as HTMLElement ) . style [ styleKey ] = styleValue ;
39
+ }
33
40
} else {
34
- node . tagName === "Fragment"
35
- ? null
36
- : // @ts -ignore
37
- el . setAttribute ( camelToDash ( key ) , attributes [ key ] ) ;
41
+ if ( ! ( node . tagName === "Fragment" ) ) {
42
+ ( el as HTMLElement ) . setAttribute ( camelToDash ( key ) , value ) ;
43
+ }
38
44
}
39
45
}
40
46
You can’t perform that action at this time.
0 commit comments