summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-form-element/form-indexed-element-shadow.html
blob: a108ce8a93fcc75bc9144b6409c083943fcb93f3 (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
<!doctype html>
<meta charset="utf-8">
<title>form.elements: indexed access reflects DOM order, not flat tree</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<form id="target">
  <div id="host">
    <template shadowrootmode="open">
      <slot name="first"></slot>
      <slot name="second"></slot>
    </template>
    <input id="first" slot="second">
    <input id="second" slot="first">
  </div>
</form>
<script>
test(function() {
  let target = document.getElementById("target");
  let host = document.getElementById("host");
  assert_true(!!host.shadowRoot, "Should have a shadow tree");
  assert_equals(target.elements[0], first, "form.elements reflects DOM order, not flat tree order");
  assert_equals(target.elements[1], second);
});
</script>