Skip to content

Commit b7179ad

Browse files
authored
declare var to fix scope error
By not declaring var i = 0, the code is referencing the i declared in the outer function. This causes an infinite loop condition that crashes browsers as multiple methods modify the value of i.
1 parent 7c711dd commit b7179ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ define([
168168
}
169169

170170
if (parent && config && config.length) {
171-
for (i = 0; i < config.length; i++) {
171+
for (var i = 0; i < config.length; i++) {
172172
categoryLoader.processCategoryTree(parent, config, i);
173173
}
174174
}
@@ -185,7 +185,7 @@ define([
185185
if ((node.childNodes.length > 0) || (node.loaded === false && node.loading === false)) {
186186
hash.children = [];
187187

188-
for (i = 0, len = node.childNodes.length; i < len; i++) {
188+
for (var i = 0, len = node.childNodes.length; i < len; i++) {
189189
/* eslint-disable */
190190
if (!hash.children) {
191191
hash.children = [];

0 commit comments

Comments
 (0)