Bug #90208
closedincludeJS + defer does not work if the ResourceCompressor has done its job
100%
Description
I use Typo3 9.5.13.
According to the documentation the attribute defer is supported:
defer:
[[https://www.w3schools.com/tags/att_script_defer.asp]]
Here is an example typo scripting:
page.includeJS.a2hs = /fileadmin/a2hs/a2hs.js
page.includeJS.a2hs.defer = 1
But unfortunately the defer attribute is not included in the HTML source code.
After my analysis the defer flag arrives in PageRenderer
and is placed in the array $this->jsFiles
. But then comes the ResourceCompressor:
In the method ResourceCompressor#concatenateJsFiles(array $jsFiles)
will "forget" the defer flag.
Unfortunately this method is too complicated for me and I don't know which attributes still disappear like this. Otherwise I would have submitted a correction suggestion here.
Thanks for your help.
My current workaround is:
page.headerData.30 = TEXT
page.headerData.30.value = <script src="/fileadmin/a2hs/a2hs.js" defer></script>
Translated with www.DeepL.com/Translator (free version)
Updated by Gerrit Code Review almost 5 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63040
Updated by Gerrit Code Review over 4 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63779
Updated by Gerrit Code Review over 4 years ago
Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63779
Updated by Guido Schmechel over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 9293c59b2b5d511254af261471338ecc1c081420.
Updated by Benni Mack over 4 years ago
- Related to Bug #87444: 'config.concatenateJs = 1' async feature does not work added