excid3 / tailwindcss-stimulus-components

A set of StimulusJS components for TailwindCSS apps similar to Bootstrap JS components.

Home Page:https://excid3.github.io/tailwindcss-stimulus-components/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dropdown.js: what is `hasButtonTarget`?

MaffooClock opened this issue · comments

In dropdown.js, the connect() and disconnect() methods perform a conditional action based on this.hasButtonTarget, but it doesn't appear to be defined nor used anywhere, and therefore seems to have no purpose.

if (this.hasButtonTarget) {
this.buttonTarget.addEventListener("keydown", this._onMenuButtonKeydown)
}

if (this.hasButtonTarget) {
this.buttonTarget.removeEventListener("keydown", this._onMenuButtonKeydown)
}

Is this extra cruft that should be removed?

Stimulus defines those automatically for targets. https://stimulus.hotwired.dev/reference/targets#properties