about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-02-04 22:19:19 +0100
committerbptato <nincsnevem662@gmail.com>2025-02-04 22:19:19 +0100
commit8af354f43a79953b9207e63e81ff8eb2713b34db (patch)
tree69ca81f56e03d3f1fcd9ccc3c9f5d3e47248903f
parent5a1a46526d4c1db2f305391b1e326f412a9c645d (diff)
downloadchawan-8af354f43a79953b9207e63e81ff8eb2713b34db.tar.gz
cssparser: fix parsing of consequitive comments
-rw-r--r--src/css/cssparser.nim2
-rw-r--r--test/layout/double-comment-parsing.expected1
-rw-r--r--test/layout/double-comment-parsing.html5
3 files changed, 7 insertions, 1 deletions
diff --git a/src/css/cssparser.nim b/src/css/cssparser.nim
index d5a4a558..751ff2f5 100644
--- a/src/css/cssparser.nim
+++ b/src/css/cssparser.nim
@@ -386,7 +386,7 @@ proc consumeIdentLikeToken(state: var CSSTokenizerState): CSSToken =
   return CSSToken(t: cttIdent, value: s)
 
 proc consumeComments(state: var CSSTokenizerState) =
-  if state.has(1) and state.peek() == '/' and state.peek(1) == '*':
+  while state.has(1) and state.peek() == '/' and state.peek(1) == '*':
     state.seek(2)
     while state.has() and not (state.has(1) and state.peek() == '*' and
         state.peek(1) == '/'):
diff --git a/test/layout/double-comment-parsing.expected b/test/layout/double-comment-parsing.expected
new file mode 100644
index 00000000..883dabdf
--- /dev/null
+++ b/test/layout/double-comment-parsing.expected
@@ -0,0 +1 @@
+ test
diff --git a/test/layout/double-comment-parsing.html b/test/layout/double-comment-parsing.html
new file mode 100644
index 00000000..1b1ab33e
--- /dev/null
+++ b/test/layout/double-comment-parsing.html
@@ -0,0 +1,5 @@
+<style>
+/**//**/
+#x { margin-left: 1ch }
+</style>
+<div id=x>test</div>