1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-10-01 07:46:47 +02:00

Remove Manipulator.toggleClass (#31842)

It's only used in one place so it makes more sense to remove it for the time being.
This commit is contained in:
XhmikosR
2020-10-05 18:07:49 +03:00
committed by GitHub
parent 00dd55269a
commit 0c1651ee9d
3 changed files with 4 additions and 42 deletions

View File

@@ -72,18 +72,6 @@ const Manipulator = {
top: element.offsetTop,
left: element.offsetLeft
}
},
toggleClass(element, className) {
if (!element) {
return
}
if (element.classList.contains(className)) {
element.classList.remove(className)
} else {
element.classList.add(className)
}
}
}

View File

@@ -197,8 +197,8 @@ class Dropdown {
this._element.focus()
this._element.setAttribute('aria-expanded', true)
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW)
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW)
this._menu.classList.toggle(CLASS_NAME_SHOW)
this._element.classList.toggle(CLASS_NAME_SHOW)
EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget)
}
@@ -222,8 +222,8 @@ class Dropdown {
this._popper.destroy()
}
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW)
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW)
this._menu.classList.toggle(CLASS_NAME_SHOW)
this._element.classList.toggle(CLASS_NAME_SHOW)
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget)
}