From fe308d780e7f65ec9241c8d7c15bcb347e3eac61 Mon Sep 17 00:00:00 2001 From: Andriy Nasinnyk <anasinnyk@ebay.com> Date: Mon, 16 Mar 2015 11:58:07 +0200 Subject: [PATCH] MAGETWO-34293: Html minification works incorrectly in Layered Navigation --- .../Framework/View/Template/Html/Minifier.php | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Template/Html/Minifier.php b/lib/internal/Magento/Framework/View/Template/Html/Minifier.php index f807ed11b43..218e20a4e08 100644 --- a/lib/internal/Magento/Framework/View/Template/Html/Minifier.php +++ b/lib/internal/Magento/Framework/View/Template/Html/Minifier.php @@ -113,22 +113,26 @@ class Minifier implements MinifierInterface { $file = $this->rootDirectory->getRelativePath($file); $content = preg_replace( - '#((?:<\?php\s+(?!echo)[^\?]*)\?>)\s+#', - '$1', + '#\s+</#', + '</', preg_replace( - '#(?<!' . implode('|', $this->inlineHtmlTags) . ')\> \<#', - '><', + '#((?:<\?php\s+(?!echo)[^\?]*)\?>)\s+#', + '$1', preg_replace( - '#(?ix)(?>[^\S ]\s*|\s{2,})(?=(?:(?:[^<]++|<(?!/?(?:textarea|pre|script)\b))*+)' - . '(?:<(?>textarea|pre|script)\b|\z))#', - ' ', + '#(?<!' . implode('|', $this->inlineHtmlTags) . ')\> \<#', + '><', preg_replace( - '#(?<!:)//(?!\s*\<\!\[)(?!\s*]]\>)[^\n\r]*#', - '', + '#(?ix)(?>[^\S ]\s*|\s{2,})(?=(?:(?:[^<]++|<(?!/?(?:textarea|pre|script)\b))*+)' + . '(?:<(?>textarea|pre|script)\b|\z))#', + ' ', preg_replace( - '#(?<!:)//[^\n\r]*(\s\?\>)#', - '$1', - $this->rootDirectory->readFile($file) + '#(?<!:)//(?!\s*\<\!\[)(?!\s*]]\>)[^\n\r]*#', + '', + preg_replace( + '#(?<!:)//[^\n\r]*(\s\?\>)#', + '$1', + $this->rootDirectory->readFile($file) + ) ) ) ) -- GitLab