<html>
<head>
<script>

function runTest() {
    if (window.testRunner)
        testRunner.dumpAsText();

    var label1 = document.getElementById('label1');
    label1.focus();
    if (document.getElementById('cb1') != document.activeElement)
        return;

    var label2 = document.getElementById('label2');
    label2.focus();
    if (document.getElementById('cb2') != document.activeElement)
        return;
    document.getElementById('result').innerHTML = 'SUCCESS'
}

</script>
</head>
<body onload="runTest()">
This tests that the correct form control element is activated when clicking on a label.
If the test is successful, the text "SUCCESS" should show below.<br>
<Label id="label1">label1<input id="cb1" type="checkbox"></label><br>
<Label id="label2">label2<fieldset><legend><input id="cb2" type="checkbox"></legend></fieldset></label><br>
<div id="result">FAILURE</div>

</body>
</html>

