about summary refs log tree commit diff stats
path: root/src/html
diff options
context:
space:
mode:
Diffstat (limited to 'src/html')
-rw-r--r--src/html/catom.nim1
-rw-r--r--src/html/dom.nim6
2 files changed, 7 insertions, 0 deletions
diff --git a/src/html/catom.nim b/src/html/catom.nim
index 9180ecd6..7c61e23e 100644
--- a/src/html/catom.nim
+++ b/src/html/catom.nim
@@ -16,6 +16,7 @@ macro makeStaticAtom =
       satAlign = "align"
       satAlt = "alt"
       satAsync = "async"
+      satAutofocus = "autofocus"
       satBgcolor = "bgcolor"
       satBlocking = "blocking"
       satCharset = "charset"
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 6eb1079f..d09849c7 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -2336,6 +2336,12 @@ func findAnchor*(document: Document; id: string): Element =
       return child
   return nil
 
+func findAutoFocus*(document: Document): Element =
+  for child in document.elements:
+    if child.attrb(satAutofocus):
+      return child
+  return nil
+
 # Forward declaration hack
 isDefaultPassive = func (eventTarget: EventTarget): bool =
   if eventTarget of Window: