Project

General

Profile

Actions

Bug #100954

closed

Additional attributes for page.include** partially broken

Added by Peter Neumann over 1 year ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2023-06-03
Due date:
% Done:

100%

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

Description

TYPO3 v12.1 has introduced the possibility to add additional additional tag attributes for CSS and JavaScript files.

The feature seems to be broken for these include types:

page {
  includeJSLibs {
    someIncludeFile = EXT:sitepackage/...
    someIncludeFile.data-foo = bar
  }
  includeJS {
    someIncludeFile = EXT:sitepackage/...
    someIncludeFile.data-foo = bar
  }
  includeJSFooter {
    someIncludeFile = EXT:sitepackage/...
    someIncludeFile.data-foo = bar
  }
}

These are working:

page {
  includeCSSLibs {
    someIncludeFile = EXT:sitepackage/...
    someIncludeFile.data-foo = bar
  }
  includeCSS {
    someIncludeFile = EXT:sitepackage/...
    someIncludeFile.data-foo = bar
  }
  includeJSFooterlibs {
    someIncludeFile = EXT:sitepackage/...
    someIncludeFile.data-foo = bar
  }
}

For includeJSFooterlibs however, it is also mapping reserved attributes like the forceOnTop in the output source code to <script src="/_assets/dca94d8cd3b58fdfd24fde44814e41a3/…" forceontop="1" data-foo="bar"></script>


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Feature #91499: Additional attributes for includeJS, includeCSS and all others include**Closed2020-05-26

Actions
Related to TYPO3 Core - Task #103882: unify additionalAttributes with includeCSS / includeJSNew2024-05-23

Actions
Actions #1

Updated by Oliver Hader over 1 year ago

  • Related to Feature #91499: Additional attributes for includeJS, includeCSS and all others include** added
Actions #2

Updated by Oliver Hader over 1 year ago

  • Status changed from New to Accepted

\TYPO3\CMS\Frontend\Http\RequestHandler should filter out these properties (in the first place, tag attributes and TypoScript instructions should not have been mixed, but that started years ago already).

Actions #3

Updated by Ernesto Baschny about 1 year ago

For the includeJS properties, the implementation in 12.1 (https://review.typo3.org/c/Packages/TYPO3.CMS/+/65008) introduced a new array key `data.` where these additional attributes are to be added. A nice idea, but:

This indeed works:

page {
includeJSLibs {
someIncludeFile = EXT:sitepackage/...
someIncludeFile.data.data-foo = bar
}
includeJS {
someIncludeFile = EXT:sitepackage/...
someIncludeFile.data.data-foo = bar
}
includeJSFooter {
someIncludeFile = EXT:sitepackage/...
someIncludeFile.data.data-foo = bar
}
}

So a solution to keep it compatible with this wrong setup but streamline it would be:

  • Introduce a `additionalAttributes.` to both includeCSS and * includeJS properties, to clearly separate them from "internal and documented" attributes (i.e. we saw "if" breaking and other side effects.
  • keep the current handling for 12.x? Then it should at least be correctly documented, and the documentation should then also mention that it "will change in 13.x" if it is decided.
Actions #4

Updated by Ernesto Baschny about 1 year ago

Since we stumbled over this via the documentation and after it not working digging into the code, I opened an issue to fix the documentation meanwhile: https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-Typoscript/issues/788

Actions #5

Updated by Felix Nagel 12 months ago

Run into this issue when updating an instance from v11.4 to v12.4.8.

Actions #6

Updated by Fronzes Philippe 10 months ago · Edited

'forceOnTop' should be unset in the RequestHandler.php in the same way as others TS properties, lines 500 and following, and also 557 and following

unset(
    $additionalAttributes['if.'],
    $additionalAttributes['type'],
    $additionalAttributes['crossorigin'],
    $additionalAttributes['integrity'],
    $additionalAttributes['external'],
    $additionalAttributes['allWrap'],
    $additionalAttributes['allWrap.'],
    $additionalAttributes['disableCompression'],
    $additionalAttributes['excludeFromConcatenation'],
    $additionalAttributes['integrity'],
    $additionalAttributes['defer'],
    $additionalAttributes['nomodule'],
);

Actions #7

Updated by Gerrit Code Review 7 months ago

  • Status changed from Accepted 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/+/84182

Actions #8

Updated by Gerrit Code Review 7 months ago

Patch set 2 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/+/84182

Actions #9

Updated by Gerrit Code Review 7 months ago

Patch set 3 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/+/84182

Actions #10

Updated by Gerrit Code Review 6 months ago

Patch set 4 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/+/84182

Actions #11

Updated by Gerrit Code Review 6 months ago

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

Actions #12

Updated by Gerrit Code Review 6 months ago

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

Actions #13

Updated by Garvin Hicking 6 months ago

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

Updated by Garvin Hicking 6 months ago

(Note: Will work on seeing if we can unify the behaviour so that data.data-XXX and data-XXX is both possible, then deprecate one variant, and have a BC in v14 to no longer have duplication. Or we decide, duplication is fine. I'll probably create a new issue for this and link this)

Actions #15

Updated by Markus Volkmer 6 months ago

  • Related to Task #103882: unify additionalAttributes with includeCSS / includeJS added
Actions #16

Updated by Benni Mack 4 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF