about summary refs log tree commit diff stats
path: root/src/css/match.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/css/match.nim')
-rw-r--r--src/css/match.nim10
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))