diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/category-checkbox-tree.js b/app/code/Magento/Catalog/view/adminhtml/web/js/category-checkbox-tree.js index abe9f626eb8b6..40272272623e5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/category-checkbox-tree.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/category-checkbox-tree.js @@ -32,9 +32,7 @@ define([ data = {}, parameters = {}, root = {}, - len = 0, - key = '', - i = 0; + key = ''; /* eslint-disable */ /** @@ -162,14 +160,16 @@ define([ * @returns {void} */ categoryLoader.buildCategoryTree = function (parent, config) {// eslint-disable-line no-shadow + var i = 0; if (!config) { return null; } if (parent && config && config.length) { - for (i = 0; i < config.length; i++) { + while (i < config.length) { categoryLoader.processCategoryTree(parent, config, i); + i++; } } }; @@ -181,17 +181,21 @@ define([ * @returns {Object} */ categoryLoader.buildHashChildren = function (hash, node) {// eslint-disable-line no-shadow + var i = 0, len; + // eslint-disable-next-line no-extra-parens if ((node.childNodes.length > 0) || (node.loaded === false && node.loading === false)) { + len = node.childNodes.length; hash.children = []; - for (i = 0, len = node.childNodes.length; i < len; i++) { + while (i < len) { /* eslint-disable */ if (!hash.children) { hash.children = []; } /* eslint-enable */ hash.children.push(this.buildHash(node.childNodes[i])); + i++; } }