about summary refs log tree commit diff stats
path: root/src/html
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-07 18:01:31 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-07 18:01:54 +0200
commit4dfa5ffc00869e4351f0487ec5c797b10e2f9950 (patch)
tree805101846cd049e5533e89aca330c7dec38781a2 /src/html
parent9668b12761cb121852c2bcc085b8f6b18eb4bfc6 (diff)
downloadchawan-4dfa5ffc00869e4351f0487ec5c797b10e2f9950.tar.gz
dom: set input type to text if not given
HTMLInputElement.inputString depends on inputType not being unknown.

(Maybe we should move this logic out of the html parser module
entirely and just set text as the default value...)
Diffstat (limited to 'src/html')
-rw-r--r--src/html/dom.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 0f9cb3ef..1237d701 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -2137,6 +2137,8 @@ proc reflectAttrs(element: Element, name, value: string) =
     let input = HTMLInputElement(element)
     input.reflect_str "value", value
     input.reflect_str "type", inputType, inputType
+    if input.inputType == INPUT_UNKNOWN:
+      input.inputType = INPUT_TEXT
     input.reflect_bool "checked", checked
   of TAG_OPTION:
     let option = HTMLOptionElement(element)