Bug #98927
openJS async option of includeJS broke by file in includeJSFooter
0%
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.
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 ?
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