mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-30 22:52:24 +01:00
simplify initialization on data-toggle
click
This commit is contained in:
parent
6f17e634ce
commit
e5b606d242
@ -322,12 +322,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
|
|||||||
const selectorElements = SelectorEngine.find(selector)
|
const selectorElements = SelectorEngine.find(selector)
|
||||||
|
|
||||||
selectorElements.forEach(element => {
|
selectorElements.forEach(element => {
|
||||||
const data = Collapse.getInstance(element)
|
Collapse.getOrCreateInstance(element, { toggle: false }).toggle()
|
||||||
if (data) {
|
|
||||||
data.toggle()
|
|
||||||
} else {
|
|
||||||
Collapse.getOrCreateInstance(element)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user