0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-30 22:52:24 +01:00

collapse: merge class toggling

This commit is contained in:
GeoSot 2021-11-02 16:40:34 +02:00 committed by XhmikosR
parent b5147ec218
commit a8887ea8a8

View File

@ -249,12 +249,7 @@ class Collapse extends BaseComponent {
}
for (const element of triggerArray) {
if (isOpen) {
element.classList.remove(CLASS_NAME_COLLAPSED)
} else {
element.classList.add(CLASS_NAME_COLLAPSED)
}
element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen)
element.setAttribute('aria-expanded', isOpen)
}
}