File tree Expand file tree Collapse file tree 1 file changed +28
-6
lines changed
src/client/packages/idom-client-react/src Expand file tree Collapse file tree 1 file changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,19 @@ const elementTransformCategories = {
5050 }
5151 } ,
5252 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+ } ,
5966} ;
6067
6168function defaultElementTransform ( element ) {
@@ -77,6 +84,21 @@ const elementTagCategories = {
7784 hasCurrentTime : [ "AUDIO" , "VIDEO" ] ,
7885 hasFiles : [ "INPUT" ] ,
7986 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+ ] ,
80102} ;
81103
82104const elementTransforms = { } ;
You can’t perform that action at this time.
0 commit comments