Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton <info@ensostudio.ru>2022-02-07 11:50:26 +0300
committerGitHub <noreply@github.com>2022-02-07 11:50:26 +0300
commita805330f63e092ba8f4583ccf6e16630ada8d86f (patch)
treebc67e1601e33ba6a27e1d6d633d14481647405b8
parent77e02a07c750ca14705399160e8760d6a554e41f (diff)
Optimize jQueryInterface in Collapse (#35689)
extracts config initialization from cycle
-rw-r--r--js/src/collapse.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/js/src/collapse.js b/js/src/collapse.js
index 8894342dfc..b1088e106f 100644
--- a/js/src/collapse.js
+++ b/js/src/collapse.js
@@ -256,12 +256,12 @@ class Collapse extends BaseComponent {
// Static
static jQueryInterface(config) {
- return this.each(function () {
- const _config = {}
- if (typeof config === 'string' && /show|hide/.test(config)) {
- _config.toggle = false
- }
+ const _config = {}
+ if (typeof config === 'string' && /show|hide/.test(config)) {
+ _config.toggle = false
+ }
+ return this.each(function () {
const data = Collapse.getOrCreateInstance(this, _config)
if (typeof config === 'string') {