Skip to content

Commit

Permalink
simplify initialization on data-toggle click
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSot committed Jul 6, 2021
1 parent 33bf64a commit ef76ac2
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions js/src/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
const selectorElements = SelectorEngine.find(selector)

selectorElements.forEach(element => {
const data = Collapse.getInstance(element)
if (data) {
data.toggle()
} else {
Collapse.getOrCreateInstance(element)
}
Collapse.getOrCreateInstance(element, { toggle: false }).toggle()
})
})

Expand Down

0 comments on commit ef76ac2

Please sign in to comment.