Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / nth-child-n.html
blobb6d7023c713672b89bb5669977475730fb8cebd2
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
2 <html>
3 <head>
4 <title>CSS Test: :nth-child(n) selector</title>
5 <style type="text/css">
6 div div:nth-child(n) { color: green; }
7 </style>
8 <script>
9 if (window.testRunner)
10 window.testRunner.dumpAsText()
11 </script>
12 </head>
13 <body>
14 <p>The test passes if all DIVs are green.</p>
15 <div id="test">
16 <div>DIV1</div>
17 <div>DIV2</div>
18 </div>
19 <div id="testresult" style="color: blue">Running</div>
20 <script type="text/javascript">
21 function ArrayContains(array, value, ci)
23 ci = ci == true ? true : false;
24 for (var i = 0; i < array.length; i++)
26 if (ci && array[i].toLowerCase() == value.toLowerCase())
28 return true;
30 else if (array[i] == value)
32 return true;
35 return false;
38 function TestCase()
40 try
42 var greenValues = new Array("green", "#008000", "rgb(0, 128, 0)");
44 var elem = document.getElementById("test");
45 var val = getComputedStyle(elem.children[0], null).getPropertyValue("color");
46 if (ArrayContains(greenValues, val, false))
48 document.getElementById("testresult").innerHTML = "Pass";
49 return;
51 }catch(e){}
52 document.getElementById("testresult").innerHTML = "Fail";
54 TestCase();
55 </script>
56 </body>
57 </html>