]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
transfer `interface` inside `jQueryInterface`
authorGeoSot <geo.sotis@gmail.com>
Thu, 10 Jun 2021 00:00:40 +0000 (03:00 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Thu, 29 Jul 2021 13:30:02 +0000 (16:30 +0300)
js/src/collapse.js

index b238738d947670c199a155e78b5a09e9b8e13ccd..7c66b2eca0bf66dca652d9264bfca44e23e4333c 100644 (file)
@@ -147,7 +147,7 @@ class Collapse extends BaseComponent {
 
     actives.forEach(elemActive => {
       if (container !== elemActive) {
-        Collapse.collapseInterface(elemActive, 'hide')
+        Collapse.getOrCreateInstance(elemActive, { toggle: false }).hide()
       }
 
       if (!activesData) {
@@ -282,26 +282,22 @@ class Collapse extends BaseComponent {
 
   // Static
 
-  static collapseInterface(element, config) {
-    const _config = {}
-    if (typeof config === 'string' && /show|hide/.test(config)) {
-      _config.toggle = false
-    }
-
-    const data = Collapse.getOrCreateInstance(element, _config)
-
-    if (typeof config === 'string') {
-      if (typeof data[config] === 'undefined') {
-        throw new TypeError(`No method named "${config}"`)
+  static jQueryInterface(config) {
+    return this.each(function () {
+      const _config = {}
+      if (typeof config === 'string' && /show|hide/.test(config)) {
+        _config.toggle = false
       }
 
-      data[config]()
-    }
-  }
+      const data = Collapse.getOrCreateInstance(this, _config)
 
-  static jQueryInterface(config) {
-    return this.each(function () {
-      Collapse.collapseInterface(this, config)
+      if (typeof config === 'string') {
+        if (typeof data[config] === 'undefined') {
+          throw new TypeError(`No method named "${config}"`)
+        }
+
+        data[config]()
+      }
     })
   }
 }