summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-legend-element/legend-form.html
blob: b127164aed07ddc45c4e71b42807265a78db3b80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTMLLegendElement Test: form</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div id="log"></div>

<div style="display:none">
  <form id="testform">
    <legend id="testlegend">radio</legend>
  </form>
</div>

<div style="display:none">
  <form id="testformWithFieldSet">
    <fieldset>
    <legend id="legendWithFieldSet">radio</legend>
    </fieldset>
  </form>
</div>
<script>
test(function () {
  var legendEle = document.getElementById("legendWithFieldSet");
  assert_not_equals(legendEle.form, null);
  assert_equals(legendEle.form, document.getElementById("testformWithFieldSet"));
}, "Check if legend.form returns its parent when it's inside a fieldset");
test(function () {
  var legendEle = document.getElementById("testlegend");
  assert_equals(legendEle.form, null);
}, "Check if legend.form return null when legend has no fieldset element as its parent");
</script>