| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN"> |
| <html> |
| <head> |
| <title>CSS Test: :indeterminate and input type=radio</title> |
| <style type="text/css"> |
| div |
| { |
| color: green; |
| } |
| input:indeterminate + #test |
| { |
| color: red; |
| } |
| </style> |
| </head> |
| <body onload="mytest()"> |
| <p>The test passes if the Filler Text below is green.</p> |
| <input type="radio" /> |
| <div id="test">Filler Text</div> |
| <div id="testresult" style="color: blue">Running</div> |
| <script type="text/javascript"> |
| |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| function mytest() |
| { |
| try |
| { |
| function ArrayContains(array, value, ci) |
| { |
| ci = ci == true ? true : false; |
| for (var i = 0; i < array.length; i++) |
| { |
| if (ci && array[i].toLowerCase() == value.toLowerCase()) |
| { |
| return true; |
| } |
| else if (array[i] == value) |
| { |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| var target = document.getElementById("test"); |
| var val = getComputedStyle(target, null).getPropertyValue("color"); |
| var aExpectedValues = new Array("red", "#FF0000", "rgb(255, 0, 0)"); |
| let wasIndeterminate = ArrayContains(aExpectedValues, val, true); |
| |
| document.getElementsByTagName("input")[0].indeterminate = true; |
| |
| if (wasIndeterminate && ArrayContains(aExpectedValues, val, true)) |
| { |
| |
| document.getElementById("testresult").innerHTML = "Pass"; |
| return; |
| } |
| } |
| catch(e){} |
| |
| document.getElementById("testresult").innerHTML = "Fail"; |
| |
| } |
| </script> |
| |
| |
| </body> |
| </html> |