about summary refs log tree commit diff stats
path: root/src/buffer
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-19 21:03:15 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-19 21:03:15 +0100
commitea9df035a294bf1cfa715c140d0d22aa018e262e (patch)
tree9f1ec79e96003494666970c16f905c0b0c9608ff /src/buffer
parentdad0c1c04b6d4f67da407f69cec98221d178c194 (diff)
downloadchawan-ea9df035a294bf1cfa715c140d0d22aa018e262e.tar.gz
More DOM work
Diffstat (limited to 'src/buffer')
-rw-r--r--src/buffer/buffer.nim10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index e5002fb7..ad22df83 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -557,20 +557,12 @@ proc loadResource(buffer: Buffer, document: Document, elem: HTMLLinkElement) =
         elem.sheet = parseStylesheet(fs.body)
 
 proc loadResources(buffer: Buffer, document: Document) =
-  var stack: seq[Element]
   if document.html != nil:
-    stack.add(document.html)
-  while stack.len > 0:
-    let elem = stack.pop()
-
-    if elem.tagType == TAG_LINK:
+    for elem in document.html.elements(TAG_LINK):
       let elem = HTMLLinkElement(elem)
       if elem.rel == "stylesheet":
         buffer.loadResource(document, elem)
 
-    for child in elem.children_rev:
-      stack.add(child)
-
 type ConnectResult* = object
   code*: int
   needsAuth*: bool