summaryrefslogtreecommitdiffstats
path: root/toolkit/components/passwordmgr/test/mochitest/formless_basic_shadow_DOM_form_and_fields_together_in_a_shadow_root.html
blob: a93e5ea752791ae2b4067267de6025cd8b894635 (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
<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>
<!-- Any copyright is dedicated to the Public Domain.
   - http://creativecommons.org/publicdomain/zero/1.0/ -->

<!-- Simple form with form, username and password fields together in a shadow root -->
<!-- This form is based off of toolkit/components/passwordmgr/test/browser/formless_basic.html -->
<span id="wrapper">
</span>
<!-- username, password and submit inputs generated programmatically below -->

<script>
  const wrapper = document.getElementById("wrapper");
  const shadow = wrapper.attachShadow({mode: "closed"});
  const fields = ["username", "password"];
  for (let field of fields) {
    const inputEle = document.createElement("input");
    inputEle.id = field;
    inputEle.name = field;
    if (field === "password") {
      inputEle.type = field;
    }
    shadow.append(inputEle);
  }
  const submitButton = document.createElement("input");
  submitButton.id = "submit";
  submitButton.type = "submit";
  shadow.append(submitButton);
</script>

</body></html>