]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Dropdown: use only one check for shown state
authorGeoSot <geo.sotis@gmail.com>
Mon, 13 Dec 2021 00:17:03 +0000 (02:17 +0200)
committerXhmikosR <xhmikosr@gmail.com>
Sun, 30 Jan 2022 16:01:09 +0000 (18:01 +0200)
js/src/dropdown.js

index efc3f2be3ca681a2307933eaf153aa1ba0eb115f..f6363040958741a6edbbfa2c5efe4234fae99af9 100644 (file)
@@ -114,7 +114,7 @@ class Dropdown extends BaseComponent {
   }
 
   show() {
-    if (isDisabled(this._element) || this._isShown(this._menu)) {
+    if (isDisabled(this._element) || this._isShown()) {
       return
     }
 
@@ -149,7 +149,7 @@ class Dropdown extends BaseComponent {
   }
 
   hide() {
-    if (isDisabled(this._element) || !this._isShown(this._menu)) {
+    if (isDisabled(this._element) || !this._isShown()) {
       return
     }
 
@@ -233,8 +233,8 @@ class Dropdown extends BaseComponent {
     this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)
   }
 
-  _isShown(element = this._element) {
-    return element.classList.contains(CLASS_NAME_SHOW)
+  _isShown() {
+    return this._menu.classList.contains(CLASS_NAME_SHOW)
   }
 
   _getPlacement() {