diff options
author | Anton <info@ensostudio.ru> | 2022-02-07 11:50:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 11:50:26 +0300 |
commit | a805330f63e092ba8f4583ccf6e16630ada8d86f (patch) | |
tree | bc67e1601e33ba6a27e1d6d633d14481647405b8 /js/src/collapse.js | |
parent | 77e02a07c750ca14705399160e8760d6a554e41f (diff) |
Optimize jQueryInterface in Collapse (#35689)
extracts config initialization from cycle
Diffstat (limited to 'js/src/collapse.js')
-rw-r--r-- | js/src/collapse.js | 10 |
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') { |