about summary refs log tree commit diff stats
path: root/test/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-12-17 18:41:49 +0100
committerbptato <nincsnevem662@gmail.com>2024-12-17 18:41:49 +0100
commit340042ea464c7b9e0eec6ff7ffb7839eb927ad62 (patch)
treef30bf68edc9492e52a605b6bdf8fb2b63cad5828 /test/layout
parent60d22e5c6106ef36202bdfa236a6461a2561dacd (diff)
downloadchawan-340042ea464c7b9e0eec6ff7ffb7839eb927ad62.tar.gz
dom, match: optimize :nth-child, :nth-last-child
I want to use it in the UA sheet, so the loop won't cut it.

(Also fix a parsing bug that prevented "of" from working.)
Diffstat (limited to 'test/layout')
-rw-r--r--test/layout/nth-child.color.expected31
-rw-r--r--test/layout/nth-child.html60
2 files changed, 91 insertions, 0 deletions
diff --git a/test/layout/nth-child.color.expected b/test/layout/nth-child.color.expected
new file mode 100644
index 00000000..de99ff28
--- /dev/null
+++ b/test/layout/nth-child.color.expected
@@ -0,0 +1,31 @@
+
+  • test                                                                        
+  • test                                                                        
+  • test                                                                        
+  • test                                                                        
+  • test                                                                        
+                                                                                
+  • test                                                                        
+  • test                                                                        
+  • test                                                                        
+  • test                                                                        
+  • test                                                                        
+                                                                                
+ 1. test                                                                        
+ 2. test                                                                        
+ 3. test                                                                        
+ 4. test                                                                        
+ 5. test                                                                        
+                                                                                
+ 1. test                                                                        
+ 2. test                                                                        
+ 3. test                                                                        
+ 4. test                                                                        
+ 5. test                                                                        
+                                                                                
+ 1. test                                                                        
+ 2. test                                                                        
+ 3. test                                                                        
+ 4. test                                                                        
+ 5. test                                                                        
+
diff --git a/test/layout/nth-child.html b/test/layout/nth-child.html
new file mode 100644
index 00000000..0e648954
--- /dev/null
+++ b/test/layout/nth-child.html
@@ -0,0 +1,60 @@
+<style>
+ul[first] :nth-child(1n+0) { color: green }
+ul[first] :nth-child(2n+0) { color: blue }
+ul[first] :nth-child(0n+1) { color: red }
+
+ul[second] :nth-child(1n+0 of li) { color: lime }
+ul[second] :nth-child(2n+0 of li) { color: aliceblue }
+ul[second] :nth-child(0n+1 of li) { color: pink }
+
+ol[first] :nth-last-child(1n+0) { color: green }
+ol[first] :nth-last-child(2n+0) { color: blue }
+ol[first] :nth-last-child(0n+1) { color: red }
+
+ol[second] :nth-last-child(1n+0 of li) { color: lime }
+ol[second] :nth-last-child(2n+0 of li) { color: aliceblue }
+ol[second] :nth-last-child(0n+1 of li) { color: pink }
+
+ol[third] :nth-child(n+2) { color: red }
+</style>
+
+<body bgcolor=black text=white>
+<ul first>
+<li>test
+<li>test
+<li>test
+<li>test
+<li>test
+</ul>
+
+<ul second>
+<li>test
+<li>test
+<li>test
+<li>test
+<li>test
+</ul>
+
+<ol first>
+<li>test
+<li>test
+<li>test
+<li>test
+<li>test
+</ol>
+
+<ol second>
+<li>test
+<li>test
+<li>test
+<li>test
+<li>test
+</ol>
+
+<ol third>
+<li>test
+<li>test
+<li>test
+<li>test
+<li>test
+</ol>