From 47f4424c2b0e0c2d43b87e6591f90d87b984d838 Mon Sep 17 00:00:00 2001 From: Navarr Barnier Date: Wed, 26 Apr 2017 11:25:45 -0400 Subject: [PATCH 1/8] Add a name to the Composite\Fieldset\Options block directive Add the name "product.composite.fieldset.options" to Composite\Fieldset\Options block so that third party custom options can add their own values without re-declaring the product.composite.fieldset directive. --- .../adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE.xml b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE.xml index eb85006f69bbe..92663f0ce5c44 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE.xml @@ -8,7 +8,7 @@ - + From 29d7701ee2b87fc90f9b5bbb8b004143985dc6ea Mon Sep 17 00:00:00 2001 From: James Reed Date: Wed, 17 May 2017 11:52:03 +0100 Subject: [PATCH 2/8] Update to fix urlArgs problem corrupting the path when set in requirejs --- lib/web/mage/requirejs/mixins.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/web/mage/requirejs/mixins.js b/lib/web/mage/requirejs/mixins.js index 22f4968b25f44..eb56ec86db342 100644 --- a/lib/web/mage/requirejs/mixins.js +++ b/lib/web/mage/requirejs/mixins.js @@ -114,6 +114,12 @@ define('mixins', [ * @returns {Array} An array of paths to mixins. */ getMixins: function (path) { + + // fix for when urlArgs is set + if (path.indexOf('?')!=-1) { + path=path.substring(0,path.indexOf('?')); + } + var config = module.config() || {}, mixins = config[path] || {}; From 1c8940230d36be349fe88e9a103f734d43c6b5bc Mon Sep 17 00:00:00 2001 From: James Reed Date: Wed, 17 May 2017 13:15:40 +0100 Subject: [PATCH 3/8] Slight change of code style for mixins fix --- lib/web/mage/requirejs/mixins.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/web/mage/requirejs/mixins.js b/lib/web/mage/requirejs/mixins.js index eb56ec86db342..4b1db09ccff12 100644 --- a/lib/web/mage/requirejs/mixins.js +++ b/lib/web/mage/requirejs/mixins.js @@ -115,12 +115,14 @@ define('mixins', [ */ getMixins: function (path) { - // fix for when urlArgs is set - if (path.indexOf('?')!=-1) { - path=path.substring(0,path.indexOf('?')); + var config; + + // fix for when urlArgs is set + if (path.indexOf('?') !== -1) { + path = path.substring(0, path.indexOf('?')); } - var config = module.config() || {}, + config = module.config() || {}, mixins = config[path] || {}; return Object.keys(mixins).filter(function (mixin) { From f6d4e84482c89fdf0f3010a05b638d02047fc177 Mon Sep 17 00:00:00 2001 From: James Reed Date: Wed, 17 May 2017 13:50:58 +0100 Subject: [PATCH 4/8] Remove of whitespace from code for mixins fix --- lib/web/mage/requirejs/mixins.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/web/mage/requirejs/mixins.js b/lib/web/mage/requirejs/mixins.js index 4b1db09ccff12..737cd97294015 100644 --- a/lib/web/mage/requirejs/mixins.js +++ b/lib/web/mage/requirejs/mixins.js @@ -114,14 +114,13 @@ define('mixins', [ * @returns {Array} An array of paths to mixins. */ getMixins: function (path) { - var config; - - // fix for when urlArgs is set + + // fix for when urlArgs is set if (path.indexOf('?') !== -1) { path = path.substring(0, path.indexOf('?')); - } - + } + config = module.config() || {}, mixins = config[path] || {}; From fbce271c1d99a49d77f1b9298c208ca3222e7ac5 Mon Sep 17 00:00:00 2001 From: James Reed Date: Wed, 17 May 2017 14:23:56 +0100 Subject: [PATCH 5/8] Change to variable declaration for mixins fix --- lib/web/mage/requirejs/mixins.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/web/mage/requirejs/mixins.js b/lib/web/mage/requirejs/mixins.js index 737cd97294015..ba5c79b75e125 100644 --- a/lib/web/mage/requirejs/mixins.js +++ b/lib/web/mage/requirejs/mixins.js @@ -114,15 +114,14 @@ define('mixins', [ * @returns {Array} An array of paths to mixins. */ getMixins: function (path) { - var config; + var config = module.config() || {}, mixins; // fix for when urlArgs is set if (path.indexOf('?') !== -1) { path = path.substring(0, path.indexOf('?')); } - - config = module.config() || {}, - mixins = config[path] || {}; + + mixins = config[path] || {}; return Object.keys(mixins).filter(function (mixin) { return mixins[mixin] !== false; From 47539919042ec38d906ae3d6a5ec3aabc05cd785 Mon Sep 17 00:00:00 2001 From: James Reed Date: Wed, 17 May 2017 15:29:40 +0100 Subject: [PATCH 6/8] Trailing whitespace removal for mixins fix --- lib/web/mage/requirejs/mixins.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/web/mage/requirejs/mixins.js b/lib/web/mage/requirejs/mixins.js index ba5c79b75e125..23350c61b18c5 100644 --- a/lib/web/mage/requirejs/mixins.js +++ b/lib/web/mage/requirejs/mixins.js @@ -114,13 +114,13 @@ define('mixins', [ * @returns {Array} An array of paths to mixins. */ getMixins: function (path) { - var config = module.config() || {}, mixins; + var config = module.config() || {}, + mixins; // fix for when urlArgs is set if (path.indexOf('?') !== -1) { path = path.substring(0, path.indexOf('?')); - } - + } mixins = config[path] || {}; return Object.keys(mixins).filter(function (mixin) { From 1291747625a112258dae8ed69ab444220194885f Mon Sep 17 00:00:00 2001 From: James Reed Date: Wed, 17 May 2017 16:02:20 +0100 Subject: [PATCH 7/8] More trailing whitespace removal for mixins fix --- lib/web/mage/requirejs/mixins.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/requirejs/mixins.js b/lib/web/mage/requirejs/mixins.js index 23350c61b18c5..77d98e0f81394 100644 --- a/lib/web/mage/requirejs/mixins.js +++ b/lib/web/mage/requirejs/mixins.js @@ -120,7 +120,7 @@ define('mixins', [ // fix for when urlArgs is set if (path.indexOf('?') !== -1) { path = path.substring(0, path.indexOf('?')); - } + } mixins = config[path] || {}; return Object.keys(mixins).filter(function (mixin) { From c43ecce356b874a838c3f5fa3376bae7c4314eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wujas?= Date: Fri, 2 Jun 2017 15:57:49 +0200 Subject: [PATCH 8/8] fixes performance issue with Mage.Cookies methods, document.cookie call is not just a string property retrieving - single call can take from 0,03 to 10 milliseconds on various browsers/devices --- lib/web/mage/cookies.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/web/mage/cookies.js b/lib/web/mage/cookies.js index 34fb259b75718..ee47d69949ead 100644 --- a/lib/web/mage/cookies.js +++ b/lib/web/mage/cookies.js @@ -91,17 +91,18 @@ this.get = function (name) { var arg = name + '=', aLength = arg.length, - cLength = document.cookie.length, + cookie = document.cookie, + cLength = cookie.length, i = 0, j = 0; while (i < cLength) { j = i + aLength; - if (document.cookie.substring(i, j) === arg) { + if (cookie.substring(i, j) === arg) { return this.getCookieVal(j); } - i = document.cookie.indexOf(' ', i) + 1; + i = cookie.indexOf(' ', i) + 1; if (i === 0) { break; @@ -130,13 +131,14 @@ * @return {String} */ this.getCookieVal = function (offset) { - var endstr = document.cookie.indexOf(';', offset); + var cookie = document.cookie, + endstr = cookie.indexOf(';', offset); if (endstr === -1) { - endstr = document.cookie.length; + endstr = cookie.length; } - return decodeURIComponent(document.cookie.substring(offset, endstr)); + return decodeURIComponent(cookie.substring(offset, endstr)); }; return this;