mount method presentation

Last updated: 2026-03-04T23:21:38.428Z

Metrics

LOC: 40 Complexity: 5 Params: 1

Signature

mount(container: HTMLElement): : this

Summary

Mount the component inside container.

Source Code

  mount(container: HTMLElement): this {
    const wrapper = document.createElement("div");
    wrapper.className = [
      "fa-ss",
      this.opts.className ?? "",
      this.opts.disabled ? "fa-ss--disabled" : "",
    ]
      .filter(Boolean)
      .join(" ");

    wrapper.innerHTML = `
      <div class="fa-ss__input-wrap">
        <input
          type="text"
          class="fa-ss__input"
          autocomplete="off"
          spellcheck="false"
          placeholder="${escHtml(this.opts.placeholder ?? "Pesquisar…")}"
          value="${escHtml(this._label)}"
          ${this.opts.disabled ? "disabled" : ""}
          aria-haspopup="listbox"
          aria-expanded="false"
          role="combobox"
        />
        <span class="fa-ss__arrow" aria-hidden="true">▾</span>
      </div>
      <div class="fa-ss__dropdown" role="listbox" hidden></div>
      <input type="hidden" class="fa-ss__value" value="${escHtml(this._value)}" />
    `;

    this.root = wrapper;
    this.input = wrapper.querySelector<HTMLInputElement>(".fa-ss__input")!;
    this.dropdown = wrapper.querySelector<HTMLElement>(".fa-ss__dropdown")!;
    this.hiddenInput =
      wrapper.querySelector<HTMLInputElement>(".fa-ss__value")!;

    this.bindEvents();
    container.appendChild(wrapper);
    return this;
  }

Dependencies (Outgoing)

graph LR mount["mount"] escHtml["escHtml"] mount -->|calls| escHtml style mount fill:#dbeafe,stroke:#2563eb,stroke-width:2px click mount "1f4423dc076c52aa.html" click escHtml "a8da31674bb8fbd0.html"
TargetType
escHtml calls

No incoming dependencies.