File tree 1 file changed +2
-0
lines changed
1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ def convert_textarea_children_to_prop(vdom_tree: VdomDict) -> VdomDict:
23
23
"""Transformation that converts the text content of a <textarea> to the 'value' prop."""
24
24
# If the current tag is <textarea>, move the text content to the 'value' prop.
25
25
if vdom_tree ["tagName" ] == "textarea" and "children" in vdom_tree and vdom_tree ["children" ]:
26
+ vdom_tree .setdefault ("attributes" , {})
26
27
text_content = vdom_tree .pop ("children" )
27
28
text_content = "" .join ([child for child in text_content if isinstance (child , str )])
28
29
default_value = vdom_tree ["attributes" ].pop ("defaultValue" , "" )
@@ -36,6 +37,7 @@ def set_value_prop_on_select_element(vdom_tree: VdomDict) -> VdomDict:
36
37
# If the current tag is <select>, remove 'selected' prop from any <option> children and
37
38
# instead set the 'value' prop on the <select> tag.
38
39
if vdom_tree ["tagName" ] == "select" and "children" in vdom_tree :
40
+ vdom_tree .setdefault ("attributes" , {})
39
41
selected_options = _find_selected_options (vdom_tree )
40
42
multiple_choice = vdom_tree ["attributes" ]["multiple" ] = bool (vdom_tree ["attributes" ].get ("multiple" ))
41
43
if selected_options and not multiple_choice :
You can’t perform that action at this time.
0 commit comments