about summary refs log tree commit diff stats
path: root/src/css/match.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-01 20:01:03 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-01 20:06:56 +0200
commit3cc7f9d2131c5d6bb866da8d517391a249edd6c7 (patch)
tree4f84dd986b6642b5cb90f934d855011cc4d7a978 /src/css/match.nim
parentf848a910814842a4c6b164f7b1f0898e74083abe (diff)
downloadchawan-3cc7f9d2131c5d6bb866da8d517391a249edd6c7.tar.gz
cssparser: refactor
* factor out skipWhitespace
* remove streams dependency

(cssparser could never stream without blocking the event loop, so we
were just passing a StringStream in all cases, which made the whole
streaming pointless.)
Diffstat (limited to 'src/css/match.nim')
-rw-r--r--src/css/match.nim5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/css/match.nim b/src/css/match.nim
index 4f8fc05c..e621b332 100644
--- a/src/css/match.nim
+++ b/src/css/match.nim
@@ -1,5 +1,4 @@
 import std/options
-import std/streams
 import std/strutils
 import std/tables
 
@@ -246,14 +245,14 @@ func selectorsMatch*[T: Element|StyledNode](elem: T; cxsel: ComplexSelector;
   return elem.complexSelectorMatches(cxsel, felem)
 
 proc querySelectorAll(node: Node; q: string): seq[Element] =
-  let selectors = parseSelectors(newStringStream(q), node.document.factory)
+  let selectors = parseSelectors(q, node.document.factory)
   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(node: Node; q: string): Element =
-  let selectors = parseSelectors(newStringStream(q), node.document.factory)
+  let selectors = parseSelectors(q, node.document.factory)
   for element in node.elements:
     if element.selectorsMatch(selectors):
       return element