Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / css / nth-child-unary-prefix.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
2 <html>
3 <head>
4     <title>CSS Test: :nth-child selector with unary prefix on step</title>
5     <style type="text/css">
6     div div:nth-child(+2n+1)
7     {
8         color: green;
9     }
10 </style>
11 <script>
12 if (window.testRunner)
13   window.testRunner.dumpAsText()
14 </script>
15 </head>
16 <body>
17     <p>The test passes if the odd numbered DIVs are green.</p>
18       <div id="test">
19           <div>DIV1</div>
20           <div>DIV2</div>
21       </div>
22       <div id="testresult" style="color: blue">Running</div>
23     <script type="text/javascript">
24                 function ArrayContains(array, value, ci)
25                 {
26                     ci = ci == true ? true : false;
27                     for (var i = 0; i < array.length; i++)
28                     {
29                         if (ci && array[i].toLowerCase() == value.toLowerCase())
30                         {
31                             return true;
32                         }
33                         else if (array[i] == value)
34                         {
35                             return true;
36                         }
37                     }
38                     return false;
39                 }
40         function TestCase()
41         {
42             try
43             {
44                 var greenValues = new Array("green", "#008000", "rgb(0, 128, 0)");
45
46                 var elem = document.getElementById("test");
47                 var val = getComputedStyle(elem.children[0], null).getPropertyValue("color");
48                 if (ArrayContains(greenValues, val, false))
49                 {
50                     document.getElementById("testresult").innerHTML = "Pass";
51                     return;
52                 }
53             }catch(e){}
54             document.getElementById("testresult").innerHTML = "Fail";
55         }
56         TestCase();
57     </script>
58 </body>
59 </html>