From a805330f63e092ba8f4583ccf6e16630ada8d86f Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 7 Feb 2022 11:50:26 +0300 Subject: Optimize jQueryInterface in Collapse (#35689) extracts config initialization from cycle --- js/src/collapse.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js') 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') { -- cgit v1.2.3