<!DOCTYPE HTML>

<style>
#one + nav { color: green; }
#two+nav { color: green; }
#three +nav { color: green; }
#four+ nav { color: green; }
label+nav { color: green; }
</style>

<p>Testing label+nav selector. The test passes if all NAVs are green.</p>

<div id="one"></div>
<nav id="nav1">NAV1</nav>

<div id="two"></div>
<nav id="nav2">NAV2</nav>

<div id="three"></div>
<nav id="nav3">NAV4</nav>

<div id="four"></div>
<nav id="nav4">NAV5</nav>

<label></label>
<nav id="nav5">NAV6</nav>

<script type="text/javascript">
if (window.testRunner)
  window.testRunner.dumpAsText();

function runTest(element)
{
    var greenValues = [
        "rgb(0, 128, 0)", // WebKit, Firefox 4, IE9
        "#008000" // Opera 11.11
    ];

    var elem = document.getElementById(element);
    var val = getComputedStyle(elem, null).getPropertyValue("color");
    
    if (greenValues.indexOf(val.toLowerCase()) != -1)
       document.writeln("Pass: " + element + ".<br />");
    else
       document.writeln("Fail: " + element + " actual color is \"" + val + "\".<br />");
}

runTest("nav1");
runTest("nav2");
runTest("nav3");
runTest("nav4");
runTest("nav5");
</script>
