summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/HTMLLabelElement/focus-label.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/dom/HTMLLabelElement/focus-label.html')
-rw-r--r--LayoutTests/fast/dom/HTMLLabelElement/focus-label.html32
1 files changed, 32 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/HTMLLabelElement/focus-label.html b/LayoutTests/fast/dom/HTMLLabelElement/focus-label.html
new file mode 100644
index 0000000..b1f697d
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLLabelElement/focus-label.html
@@ -0,0 +1,32 @@
+<html>
+<head>
+<script>
+
+function runTest() {
+ if (window.layoutTestController)
+ layoutTestController.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>
+