Skip to content

Commit

Permalink
Check data exists before toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadSalman11 committed Oct 14, 2024
1 parent 88bb06b commit 9382a87
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/src/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
const button = event.target.closest(SELECTOR_DATA_TOGGLE)
const data = Button.getOrCreateInstance(button)

data.toggle()
if (data) {
data.toggle()
}
})

/**
Expand Down

0 comments on commit 9382a87

Please sign in to comment.