]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
simplify toggle
authorGeoSot <geo.sotis@gmail.com>
Thu, 8 Jul 2021 14:42:09 +0000 (17:42 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Thu, 22 Jul 2021 14:54:48 +0000 (17:54 +0300)
js/src/dropdown.js

index 09414c97beeb0e589b27ec330067d8cca489f945..be561b12822d02036a56dc6b8c6a074506fae140 100644 (file)
@@ -124,18 +124,7 @@ class Dropdown extends BaseComponent {
   // Public
 
   toggle() {
-    if (isDisabled(this._element)) {
-      return
-    }
-
-    const isActive = this._isShown()
-
-    if (isActive) {
-      this.hide()
-      return
-    }
-
-    this.show()
+    return this._isShown() ? this.hide() : this.show()
   }
 
   show() {