aboutsummaryrefslogtreecommitdiffstats
path: root/src/html
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-12-20 18:33:32 +0100
committerbptato <nincsnevem662@gmail.com>2021-12-20 18:33:32 +0100
commitcbcdafaf3fab6129c8c387bc352bd1f17f663684 (patch)
tree3cc26d9d296d83708d9a5bd99670058310ccadee /src/html
parent8f4b4977eed45bbe961a9fe3f7d75d93f53015c4 (diff)
downloadchawan-cbcdafaf3fab6129c8c387bc352bd1f17f663684.tar.gz
Implement gotoAnchor
Diffstat (limited to 'src/html')
-rw-r--r--src/html/dom.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 85a48174..faa3c846 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -306,3 +306,8 @@ func newAttr*(parent: Element, key, value: string): Attr =
result.ownerElement = parent
result.name = key
result.value = value
+
+func getElementById*(document: Document, id: string): Element =
+ if id.len == 0 or id notin document.id_elements:
+ return nil
+ return document.id_elements[id][0]