mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-17 19:06:40 +02:00
Dropdown: use only one check for shown state
This commit is contained in:
@@ -114,7 +114,7 @@ class Dropdown extends BaseComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
if (isDisabled(this._element) || this._isShown(this._menu)) {
|
if (isDisabled(this._element) || this._isShown()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ class Dropdown extends BaseComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
if (isDisabled(this._element) || !this._isShown(this._menu)) {
|
if (isDisabled(this._element) || !this._isShown()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,8 +233,8 @@ class Dropdown extends BaseComponent {
|
|||||||
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)
|
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
_isShown(element = this._element) {
|
_isShown() {
|
||||||
return element.classList.contains(CLASS_NAME_SHOW)
|
return this._menu.classList.contains(CLASS_NAME_SHOW)
|
||||||
}
|
}
|
||||||
|
|
||||||
_getPlacement() {
|
_getPlacement() {
|
||||||
|
Reference in New Issue
Block a user