summaryrefslogtreecommitdiffstats
path: root/browser/components/payments/res/components/payment-request-page.js
blob: 76b41f178ef4a49d49f1273acb29ed739c79a86d (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
34
35
36
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
 * <payment-request-page></payment-request-page>
 */

export default class PaymentRequestPage extends HTMLElement {
  constructor() {
    super();

    this.classList.add("page");

    this.pageTitleHeading = document.createElement("h2");

    // The body and footer may be pre-defined in the template so re-use them if they exist.
    this.body =
      this.querySelector(":scope > .page-body") ||
      document.createElement("div");
    this.body.classList.add("page-body");

    this.footer =
      this.querySelector(":scope > footer") || document.createElement("footer");
  }

  connectedCallback() {
    // The heading goes inside the body so it scrolls.
    this.body.prepend(this.pageTitleHeading);
    this.appendChild(this.body);

    this.appendChild(this.footer);
  }
}

customElements.define("payment-request-page", PaymentRequestPage);