diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-14 12:09:29 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-14 12:09:29 +0200 |
commit | f2930dad3e29e71a446bfcf2d04078af02fdedd0 (patch) | |
tree | 5a12237bd5d8809559c210fd02fca450946ecf15 /src | |
parent | 15c722c013c209e72a277908276c3d851943ecdd (diff) | |
download | chawan-f2930dad3e29e71a446bfcf2d04078af02fdedd0.tar.gz |
dom: fix incorrect iteration in descendants
Diffstat (limited to 'src')
-rw-r--r-- | src/html/dom.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 7843a424..7e2d967b 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -883,11 +883,12 @@ iterator branch*(node: Node): Node {.inline.} = # Returns the node's descendants iterator descendants*(node: Node): Node {.inline.} = var stack: seq[Node] - stack.add(node) + for i in countdown(node.childList.high, 0): + stack.add(node.childList[i]) while stack.len > 0: let node = stack.pop() + yield node for i in countdown(node.childList.high, 0): - yield node.childList[i] stack.add(node.childList[i]) iterator elements*(node: Node): Element {.inline.} = |