about summary refs log tree commit diff stats
path: root/src/html
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-21 16:17:52 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-21 16:17:52 +0100
commite4463ecb7c435894c5a67a3377823ab0f991a191 (patch)
treeb478d4723a55eef2ade9318a31820fb37db57e0c /src/html
parent1d660ce00967c2a457158eae85dd82247c2ae396 (diff)
downloadchawan-e4463ecb7c435894c5a67a3377823ab0f991a191.tar.gz
buffer: send title during load + other title stuff
* send title to pager as soon as it's available
* expose `title' to DOM
* rename undocumented `getTitle' js function to `title' getter in
  Container
Diffstat (limited to 'src/html')
-rw-r--r--src/html/dom.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 39083db2..a452442a 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -2653,8 +2653,8 @@ func parseURL*(document: Document, s: string): Option[URL] =
 func media*[T: HTMLLinkElement|HTMLStyleElement](element: T): string =
   return element.attr(atMedia)
 
-func title*(document: Document): string =
-  for title in document.elements(TAG_TITLE):
+func title*(document: Document): string {.jsfget.} =
+  if (let title = document.findFirst(TAG_TITLE); title != nil):
     return title.childTextContent.stripAndCollapse()
   return ""