forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparsing-css3-nthchild.html
64 lines (55 loc) · 1.69 KB
/
parsing-css3-nthchild.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<head>
<style type="text/css">
#a:nth-child(n-1) { color: green; }
#b:nth-child(n- 10) { color: green; }
#c:nth-child(n- 1 2) { color: green; }
#d:nth-child(n-b1) { color: green; }
#e:nth-child(n-+1) { color: green; }
#f:nth-child(n-1n) { color: green; }
#g:nth-child(-n-1) { color: green; }
#h:nth-child(-n- 10) { color: green; }
#i:nth-child(-n -b1) { color: green; }
#j:nth-child(-1n- b1) { color: green; }
#k:nth-child(-n-13b1) { color: green; }
#l:nth-child(-n-+1) { color: green; }
#m:nth-child(-n+n) { color: green; }
#n:nth-child(-n
- 1) { color: green; }
#o:nth-child(-n
+13) { color: green; }
</style>
<script>
/** Changes the result text font size. */
function runTest()
{
if (window.testRunner)
testRunner.dumpAsText();
var rules = document.styleSheets[0].cssRules;
var text = "";
for (var i = 0; i < rules.length; i++) {
text += rules.item(i).cssText;
text += "\n";
}
document.getElementById("result").appendChild(document.createTextNode(text));
if (document.getElementById("result").firstChild.data === document.getElementById("expected").firstChild.data)
document.getElementById("message").firstChild.data = "SUCCESS";
else
document.getElementById("message").firstChild.data = "FAILURE";
}
</script>
</head>
<body onload="runTest()">
<p id="message">TEST DID NOT COMPLETE</p>
<p>Rules from the stylesheet:</p>
<pre id="result"></pre>
<p>Expected result:</p>
<pre id="expected">#a:nth-child(n-1) { color: green; }
#b:nth-child(n- 10) { color: green; }
#g:nth-child(-n-1) { color: green; }
#h:nth-child(-n- 10) { color: green; }
#n:nth-child(-n
- 1) { color: green; }
#o:nth-child(-n
+13) { color: green; }
</pre>
</body>