]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
collapse: don't rely on implicit conversion (#30566)
authorXhmikosR <xhmikosr@gmail.com>
Fri, 17 Apr 2020 12:09:51 +0000 (15:09 +0300)
committerGitHub <noreply@github.com>
Fri, 17 Apr 2020 12:09:51 +0000 (15:09 +0300)
`config` can be an `Object` and we only need to test for `hide` or `show` if it's a `String`

js/src/collapse.js

index 4529a85ec36105c507cd8b8b4d1563c4d0e41d8b..4941ff0ac8a579feafe53aab30856d3af14a5559 100644 (file)
@@ -346,7 +346,7 @@ class Collapse {
       ...typeof config === 'object' && config ? config : {}
     }
 
-    if (!data && _config.toggle && /show|hide/.test(config)) {
+    if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
       _config.toggle = false
     }