about summary refs log tree commit diff stats
path: root/src/html
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-07-04 23:39:11 +0200
committerbptato <nincsnevem662@gmail.com>2023-07-04 23:39:11 +0200
commitecd97e8baf04c34eaf34353f66b136efce17e55d (patch)
tree59d225caa6b97b4d6b465ffda765e2a057e79a5e /src/html
parentaeba0d4737cbdd1f4cde4300cdc338eb8e10ff3d (diff)
downloadchawan-ecd97e8baf04c34eaf34353f66b136efce17e55d.tar.gz
dom: work around bad codegen
Diffstat (limited to 'src/html')
-rw-r--r--src/html/dom.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 820e63f9..e203dda1 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -2387,10 +2387,12 @@ proc setForm*(element: FormAssociatedElement, form: HTMLFormElement) =
 
 proc resetFormOwner(element: FormAssociatedElement) =
   element.parserInserted = false
-  if element.form != nil and
-      element.tagType notin ListedElements or not element.attrb("form") and
-      element.findAncestor({TAG_FORM}) == element.form:
-    return
+  if element.form != nil:
+    if element.tagType notin ListedElements:
+      return
+    let lastForm = element.findAncestor({TAG_FORM}) 
+    if not element.attrb("form") and lastForm == element.form:
+      return
   element.form = nil
   if element.tagType in ListedElements and element.attrb("form") and element.isConnected:
     let form = element.attr("form")