Commit 2b070cb 1 parent 51ba383 commit 2b070cb Copy full SHA for 2b070cb
File tree 1 file changed +28
-6
lines changed
src/client/packages/idom-client-react/src
1 file changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,19 @@ const elementTransformCategories = {
50
50
}
51
51
} ,
52
52
hasElements : ( element ) => {
53
- const result = { } ;
54
- Object . keys ( element ) . forEach ( ( key ) => {
55
- result [ key ] = serializeDomElement ( element . elements [ key ] )
56
- } ) ;
57
- return result ;
58
- }
53
+ const { elements } = element ;
54
+ const indices = [ ...Array ( elements . length ) . keys ( ) ] ;
55
+ return {
56
+ elements : indices . map ( ( index ) => serializeDomElement ( elements [ index ] ) ) ,
57
+ } ;
58
+ } ,
59
+ hasName : ( element ) => {
60
+ const { name } = element ;
61
+ // In some edge cases, "name" may not be a string. For example, in the case of
62
+ // `<form><input name="name"></form>`, the "name" attribute of the `<form>` will
63
+ // be the `<input>` element.
64
+ return typeof name === "string" ? { name } : { } ;
65
+ } ,
59
66
} ;
60
67
61
68
function defaultElementTransform ( element ) {
@@ -77,6 +84,21 @@ const elementTagCategories = {
77
84
hasCurrentTime : [ "AUDIO" , "VIDEO" ] ,
78
85
hasFiles : [ "INPUT" ] ,
79
86
hasElements : [ "FORM" ] ,
87
+ hasName : [
88
+ "BUTTON" ,
89
+ "FORM" ,
90
+ "FIELDSET" ,
91
+ "IFRAME" ,
92
+ "INPUT" ,
93
+ "KEYGEN" ,
94
+ "OBJECT" ,
95
+ "OUTPUT" ,
96
+ "SELECT" ,
97
+ "TEXTAREA" ,
98
+ "MAP" ,
99
+ "META" ,
100
+ "PARAM" ,
101
+ ] ,
80
102
} ;
81
103
82
104
const elementTransforms = { } ;
You can’t perform that action at this time.
0 commit comments