Breaking: #109998 - Removed jQuery
See forge#109998
Description
The jQuery JavaScript library is no longer shipped with TYPO3. All remaining usages in the TYPO3 backend have been migrated to native DOM APIs.
In detail, the following pieces have been removed:
- The bundled library file
EXT:core/ Resources/ Public/ Java Script/ Contrib/ jquery. js - The import map entries
jqueryandjquery/provided by EXT:core - The JavaScript module
@typo3/together with its globalbackend/ multi- step- wizard. js TYPO3.objectMulti Step Wizard
Note that
@typo3/ has been removed without
a prior deprecation phase. It was the recommended migration target when
@typo3/ was deprecated with TYPO3 v13.1
(Deprecation entry). The module is
unused within TYPO3 itself since v14.2, when the form and translation wizards
switched to the internal
typo3- web component.
Furthermore, a couple of JavaScript API signatures changed because they returned or received jQuery objects before:
Formnow returns a nativeEngine. get Field Element () HTMLElementornullinstead of a jQuery collection- The callbacks of the preview, new, duplicate and delete doc header actions
of
@typo3/(for examplebackend/ form- engine. js Form) now receive a nativeEngine. show Preview Modal () HTMLInputorElement HTMLAnchorinstead of a jQuery objectElement - The
@typo3/API no longer accepts jQuery objects as modal contentbackend/ modal. js
Impact
Extensions that import
jquery in their backend JavaScript modules will
fail to load those modules in the browser because the bare module specifier
can no longer be resolved.
Extensions using
@typo3/ or the
TYPO3. global will fail accordingly.
Extensions calling the changed
Form and
Modal methods with
jQuery semantics will trigger JavaScript errors.
Affected installations
All installations with extensions that load jQuery via the TYPO3 core import
map, use the multi step wizard module, or rely on the jQuery based
Form and
Modal API signatures in their backend JavaScript.
Migration
jQuery
Extensions that still depend on jQuery need to ship their own copy of the library and register it in their import map configuration:
return [
'dependencies' => ['core'],
'imports' => [
'jquery' => 'EXT:my_extension/Resources/Public/JavaScript/Contrib/jquery.js',
],
];
Consider migrating extension JavaScript to native DOM APIs instead.
Multi step wizard
There is no direct replacement for the removed
@typo3/ module. TYPO3 itself uses the
typo3- web component, which is currently internal and
provides no API stability guarantees yet. Extensions should either bring
their own wizard implementation, or copy the removed module into their own
codebase together with a bundled jQuery.
FormEngine
Adapt callers of the changed
Form methods to the native return
types:
-const field = FormEngine.getFieldElement(fieldName).get(0);
+const field = FormEngine.getFieldElement(fieldName);