Bug #100954
closed
Additional attributes for page.include** partially broken
Added by Peter Neumann over 1 year ago.
Updated 5 months ago.
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 to Feature #91499: Additional attributes for includeJS, includeCSS and all others include** added
- 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).
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.
Run into this issue when updating an instance from v11.4 to v12.4.8.
'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'],
);
- Status changed from Accepted to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
(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)
- Related to Task #103882: unify additionalAttributes with includeCSS / includeJS added
- Status changed from Resolved to Closed
Also available in: Atom
PDF