Project

General

Profile

Actions

Bug #98927

open

JS async option of includeJS broke by file in includeJSFooter

Added by Ian Solo about 2 years ago. Updated over 1 year ago.

Status:
Under Review
Priority:
Must have
Assignee:
-
Category:
-
Start date:
2022-10-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

To reproduce, have a Typoscript like:

page {
  includeJS {
    headerJSfile = EXT:example/Resources/Public/JavaScript/headerJSfile.js
    headerJSfile.async = 1
  }
  includeJSFooter {
    footerJSfile = EXT:example/Resources/Public/JavaScript/footerJSfile.js
  }
}

Expected behavior it a HTML code like:
<script src="/typo3temp/assets/compressed/merged-e942e6f0ca1ee79f54a389342a8850b9-78533bc4645ca634f7c62a6bbc42edef.js?1665838235" async="async"></script>
Instead async="async" is not present because of the file configured in includeJSFooter.

Actions #1

Updated by Ian Solo about 2 years ago

addJsFooterFile() adds files to $this->jsFiles with 'section' => self::PART_FOOTER

But then it seems to me that the 'section' value is not considered when deciding if to set async or not:
https://github.com/TYPO3/typo3/blob/60a666737b24a7247a59ecc7fe7b13f95c75be20/typo3/sysext/core/Classes/Resource/ResourceCompressor.php#L153

Also, $this->jsFooterFiles array seem to never be "filled".

So, why not use this array instead of mixing header and footer files in the same array $this->jsFiles ?

Actions #2

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79144

Actions

Also available in: Atom PDF