about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-07-07 22:15:44 +0200
committerbptato <nincsnevem662@gmail.com>2024-07-07 22:16:42 +0200
commit2bc57a09aeccd70c27501e67cb5078e2dc7e7ad4 (patch)
tree25c17c157e99bd5c0f6be98b33690398c3b02227 /src
parent42563d12fe70f8eaa4c765940e9bcaebf213c1cb (diff)
downloadchawan-2bc57a09aeccd70c27501e67cb5078e2dc7e7ad4.tar.gz
selectorparser: fix parseNthChild `of' token check
tokenType had to be checked too
Diffstat (limited to 'src')
-rw-r--r--src/css/selectorparser.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/css/selectorparser.nim b/src/css/selectorparser.nim
index 23ac5dea..50b172d6 100644
--- a/src/css/selectorparser.nim
+++ b/src/css/selectorparser.nim
@@ -280,7 +280,9 @@ proc parseNthChild(state: var SelectorParser; cssfunction: CSSFunction;
     inc i
   if i >= cssfunction.value.len:
     return nthchild
-  if not (get_tok cssfunction.value[i]).value.equalsIgnoreCase("of"): fail
+  let lasttok = get_tok cssfunction.value[i]
+  if lasttok.tokenType != cttIdent or not lasttok.value.equalsIgnoreCase("of"):
+    fail
   if i == cssfunction.value.len: fail
   nthchild.pseudo.ofsels = cssfunction.value[i..^1]
     .parseSelectorList(state.factory)