Project

General

Profile

Actions

Bug #90208

closed

includeJS + defer does not work if the ResourceCompressor has done its job

Added by C. Gogolin almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Start date:
2020-01-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.3
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

I use Typo3 9.5.13.

According to the documentation the attribute defer is supported:

Typo3:
[[https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.0/Feature-80542-TypoScriptJavaScriptDeferAttribute.html]]

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)


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #87444: 'config.concatenateJs = 1' async feature does not workClosed2019-01-15

Actions
Actions #1

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

Actions #2

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

Actions #3

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

Actions #4

Updated by Guido Schmechel over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #5

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions #6

Updated by Benni Mack over 4 years ago

  • Related to Bug #87444: 'config.concatenateJs = 1' async feature does not work added
Actions

Also available in: Atom PDF