Skip to content

Commit a9c4e56

Browse files
committed
MC-16005: Deferred loading / parsing of JS p2
1 parent 91bdb74 commit a9c4e56

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ public function __construct(ScopeConfigInterface $scopeConfig)
3737
*/
3838
public function beforeSendResponse(Http $subject)
3939
{
40-
if (
41-
$this->scopeConfig->isSetFlag(
42-
self::XML_PATH_DEV_MOVE_JS_TO_BOTTOM,
43-
ScopeInterface::SCOPE_STORE
44-
)
45-
) {
46-
$content = $subject->getContent();
47-
$script = [];
48-
if (strpos($content, '</body') !== false) {
40+
$content = $subject->getContent();
41+
$script = [];
42+
if (strpos($content, '</body') !== false) {
43+
if (
44+
$this->scopeConfig->isSetFlag(
45+
self::XML_PATH_DEV_MOVE_JS_TO_BOTTOM,
46+
ScopeInterface::SCOPE_STORE
47+
)
48+
) {
4949
$pattern = '#<script[^>]*+(?<!text/x-magento-template.)>.*?</script>#is';
5050
$content = preg_replace_callback(
5151
$pattern,

0 commit comments

Comments
 (0)