tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / fast / css / css3-nth-tokens-style.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../js/resources/js-test-pre.js"></script>
5 <style>
6 span.c1:nth-of-type(2n + 1){ color: red; }
7 span.c1:nth-of-type(2n - 2){ color: green; }
8 span.c2:nth-of-type(odd){ color: red; }
9 span.c2:nth-of-type(even){ color: green; }
10 span.c3:nth-of-type(n3){ color: red; }
11 span.c3:nth-of-type(foo){ color: green; }
12 span.c4:nth-of-type(2n3){ color: red; }
13 span.c4:nth-of-type(foon + bar ){ color: green; }
14
15 </style>
16
17 </head>
18 <body>
19 <p id="description"></p>
20 debug("These spans should alternate red and green");
21 <div id="test1"></div>
22 debug("These spans should alternate red and green");
23 <div id="test2"></div>
24 debug("These spans should be black");
25 <div id="test3"></div>
26 debug("These spans should be black");
27 <div id="test4"></div>
28 <br>
29 <script>
30 var i=1;
31 for(; i < 5; i++) {
32     var str = "";
33     var j=1;
34     for (; j < 9; j++) {
35         str += '<span class="c' + i + '" id="span' + i + j + '"> span </span>';
36     }
37     document.getElementById("test"+i).innerHTML = str;
38 }
39
40 </script>
41
42 <div id="console"></div>
43 <script>
44 description('This test passes if the nth-of-type can accept a parameter that is an+b, odd or even. But it does not accept any other parameter.');
45
46
47
48 el = document.getElementById("span11");
49 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('color')", "'rgb(255, 0, 0)'");
50
51 el = document.getElementById("span12");
52 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('color')", "'rgb(0, 128, 0)'");
53
54 el = document.getElementById("span21");
55 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('color')", "'rgb(255, 0, 0)'");
56
57 el = document.getElementById("span22");
58 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('color')", "'rgb(0, 128, 0)'");
59
60 el = document.getElementById("span31");
61 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('color')", "'rgb(0, 0, 0)'");
62
63 el = document.getElementById("span32");
64 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('color')", "'rgb(0, 0, 0)'");
65
66 el = document.getElementById("span41");
67 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('color')", "'rgb(0, 0, 0)'");
68
69 el = document.getElementById("span42");
70 shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('color')", "'rgb(0, 0, 0)'");
71 </script>
72 <script src="../js/resources/js-test-post.js"></script>
73 </body>
74 </html>