Skip to content

Commit 6e57b65

Browse files
committed
Scope issue with previous for and i variable
1 parent 1f3aedd commit 6e57b65

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/code/Magento/Catalog/view/adminhtml/web/js/category-checkbox-tree.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,16 @@ define([
162162
* @returns {void}
163163
*/
164164
categoryLoader.buildCategoryTree = function (parent, config) {// eslint-disable-line no-shadow
165+
var i = 0;
165166

166167
if (!config) {
167168
return null;
168169
}
169170

170171
if (parent && config && config.length) {
171-
for (i = 0; i < config.length; i++) {
172+
while (i < config.length) {
172173
categoryLoader.processCategoryTree(parent, config, i);
174+
i++;
173175
}
174176
}
175177
};
@@ -181,17 +183,21 @@ define([
181183
* @returns {Object}
182184
*/
183185
categoryLoader.buildHashChildren = function (hash, node) {// eslint-disable-line no-shadow
186+
var i = 0, len;
187+
184188
// eslint-disable-next-line no-extra-parens
185189
if ((node.childNodes.length > 0) || (node.loaded === false && node.loading === false)) {
190+
len = node.childNodes.length;
186191
hash.children = [];
187192

188-
for (i = 0, len = node.childNodes.length; i < len; i++) {
193+
while (i < len) {
189194
/* eslint-disable */
190195
if (!hash.children) {
191196
hash.children = [];
192197
}
193198
/* eslint-enable */
194199
hash.children.push(this.buildHash(node.childNodes[i]));
200+
i++;
195201
}
196202
}
197203

0 commit comments

Comments
 (0)