Skip to content

Commit

Permalink
Update select.js (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenhitchon authored Jun 12, 2024
1 parent 36e73bb commit 1895d6a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ class Select {
constructor(element) {
this.element = element
this.select = this.element.querySelector('select')
this.optGroups = this.select.getElementsByTagName('optgroup')
this.options = this.select.getElementsByTagName('option')
this.selectId = this.select.getAttribute('id')
this.optGroups = this.select && this.select.getElementsByTagName('optgroup')
this.options = this.select && this.select.getElementsByTagName('option')
this.selectId = this.select && this.select.getAttribute('id')
this.trigger = false
this.dropdown = false
this.customOptions = false
Expand Down Expand Up @@ -42,6 +42,7 @@ class Select {
}

init() {
if (!this.select) return
this.element.insertAdjacentHTML('beforeend', this.initButtonSelect() + this.initListSelect())

this.dropdown = this.element.querySelector(`.js-${this.dropdownClass}`)
Expand Down

0 comments on commit 1895d6a

Please sign in to comment.