about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/css/sheet.nim2
-rw-r--r--test/layout/unhashed-selector-after-hashed-selector.color.expected1
-rw-r--r--test/layout/unhashed-selector-after-hashed-selector.html5
3 files changed, 7 insertions, 1 deletions
diff --git a/src/css/sheet.nim b/src/css/sheet.nim
index 0746268c..ed15fe76 100644
--- a/src/css/sheet.nim
+++ b/src/css/sheet.nim
@@ -131,8 +131,8 @@ proc getSelectorIds(hashes: var SelectorHashes; sel: Selector): bool =
       hashes.class != CAtomNull or hashes.attr != CAtomNull
 
 proc add(sheet: CSSStylesheet; rule: CSSRuleDef) =
-  var hashes = SelectorHashes()
   for cxsel in rule.sels:
+    var hashes = SelectorHashes()
     hashes.getSelectorIds(cxsel)
     if hashes.tags.len > 0:
       for tag in hashes.tags:
diff --git a/test/layout/unhashed-selector-after-hashed-selector.color.expected b/test/layout/unhashed-selector-after-hashed-selector.color.expected
new file mode 100644
index 00000000..6d83f3ab
--- /dev/null
+++ b/test/layout/unhashed-selector-after-hashed-selector.color.expected
@@ -0,0 +1 @@
+test
diff --git a/test/layout/unhashed-selector-after-hashed-selector.html b/test/layout/unhashed-selector-after-hashed-selector.html
new file mode 100644
index 00000000..c5691db2
--- /dev/null
+++ b/test/layout/unhashed-selector-after-hashed-selector.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<style>
+div#a, * { color: red }
+</style>
+test