focus-label.html revision eff69b907ef2cd3a9af0351287a929c66f58e3f6
1<html> 2<head> 3<script> 4 5function runTest() { 6 if (window.layoutTestController) 7 layoutTestController.dumpAsText(); 8 9 var label1 = document.getElementById('label1'); 10 label1.focus(); 11 if (document.getElementById('cb1') != document.activeElement) 12 return; 13 14 var label2 = document.getElementById('label2'); 15 label2.focus(); 16 if (document.getElementById('cb2') != document.activeElement) 17 return; 18 document.getElementById('result').innerHTML = 'SUCCESS' 19} 20 21</script> 22</head> 23<body onload="runTest()"> 24This tests that the correct form control element is activated when clicking on a label. 25If the test is successful, the text "SUCCESS" should show below.<br> 26<Label id="label1">label1<input id="cb1" type="checkbox"></label><br> 27<Label id="label2">label2<fieldset><legend><input id="cb2" type="checkbox"></legend></fieldset></label><br> 28<div id="result">FAILURE</div> 29 30</body> 31</html> 32 33