Skip to content

Commit a448ee5

Browse files
committed
MC-15439: Deferred loading / parsing of JS
1 parent 57de58d commit a448ee5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public function beforeSendResponse(\Magento\Framework\App\Response\Http $subject
2020
{
2121
$content = $subject->getContent();
2222
$script = [];
23-
if (strpos($content, '</body') > 0) {
24-
$content = preg_replace('#<!--(?!\s?/?ko).*?-->#s', '', $content);
23+
if (strpos($content, '</body') !== false) {
2524
$pattern = '#<script[^>]*+(?<!text/x-magento-template.)>.*?</script>#is';
2625
$content = preg_replace_callback(
2726
$pattern,
@@ -36,4 +35,4 @@ function ($matchPart) use (&$script) {
3635
);
3736
}
3837
}
39-
}
38+
}

0 commit comments

Comments
 (0)