diff options
author | bptato <nincsnevem662@gmail.com> | 2022-09-13 20:44:55 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-09-13 20:44:55 +0200 |
commit | 51d83224320b8bd4e81332802bb62158ae6deec5 (patch) | |
tree | 4bfb320d7960f78a68de857f26d43ff2f59bea57 /src/css/match.nim | |
parent | 51ea622d58bfca19212fac1800cfb033bb85ec39 (diff) | |
download | chawan-51d83224320b8bd4e81332802bb62158ae6deec5.tar.gz |
More JS bindings
Diffstat (limited to 'src/css/match.nim')
-rw-r--r-- | src/css/match.nim | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/css/match.nim b/src/css/match.nim index a50f8396..7d502df1 100644 --- a/src/css/match.nim +++ b/src/css/match.nim @@ -203,15 +203,17 @@ func selectorsMatch*[T: Element|StyledNode](elem: T, selectors: ComplexSelector, return false return true -proc querySelectorAll*(document: Document, q: string): seq[Element] = +proc querySelectorAll(node: Node, q: string): seq[Element] = let selectors = parseSelectors(newStringStream(q)) - for element in document.elements: + for element in node.elements: if element.selectorsMatch(selectors): result.add(element) +doqsa = (proc(node: Node, q: string): seq[Element] = querySelectorAll(node, q)) -proc querySelector*(document: Document, q: string): Element = +proc querySelector(node: Node, q: string): Element = let selectors = parseSelectors(newStringStream(q)) - for element in document.elements: + for element in node.elements: if element.selectorsMatch(selectors): return element return nil +doqs = (proc(node: Node, q: string): Element = querySelector(node, q)) |