Review main Ready for review

92441[TASK] Avoid deprecated xlink:href namespace in svg use tags

Benjamin Franzke CR 0 V 0 Hard +147 −147 updated 11/11/26, 11:14

Commit message

`<use xlink:href="…">` is deprecated and `<use href="…">` shall
be used instead, see:
https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/xlink:href

This applies to the sprite icon markup, which is always rendered as
inline SVG in HTML documents. HTML refers to SVG 2, where `href` is
the attribute to use.

Standalone SVG files stay untouched, as SVG 1.1 requires
`xlink:href`. The SVG sanitizer fixtures therefore keep it, as they
represent uploaded files.

Executed commands:
  git grep -l "use xlink:" -- ':!*.svg' ':!*/Contrib/*' \
    ':!*/SvgDocumentFactoryTest.php' \
    | xargs sed -i 's/use xlink:href/use href/g'

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 6
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/41/92441/6 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/41/92441/6 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Merge conflicts 3

Issues 2

Files 16

Review log 1117

  1. Benjamin Franzke uploaded patch set 1 01/21/26, 12:18

  2. core-ci voted on patch set 1 V -1 01/21/26, 12:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93945

  3. Garvin Hicking updated the commit message in patch set 2 V -1 01/21/26, 16:15

  4. core-ci voted on patch set 2 V -1 01/21/26, 16:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93968

  5. Benjamin Franzke uploaded patch set 3 V -1 01/21/26, 21:20

  6. Benjamin Franzke uploaded patch set 4 01/21/26, 21:23

  7. core-ci voted on patch set 3 V -1 01/21/26, 21:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93977

  8. core-ci voted on patch set 4 V -1 01/21/26, 21:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93978

  9. Benjamin Franzke rebased onto patch set 5 V -1 01/24/26, 22:54

  10. core-ci voted on patch set 5 V +1 01/24/26, 23:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94272

  11. Garvin Hicking voted on patch set 5 CR +1 V +1 01/24/26, 23:04

  12. Benjamin Franzke commented on patch set 5 CR -1 01/28/26, 15:38

    -1 for now SVG v1.1 is still used in standalone SVGs most of the times, and SVG v1.1 required `xlink:href` to be used: https://www.w3.org/TR/SVG11/struct.html#UseElement Only SVG2 deprecated `xlink:href` in favor of `href`, but SVG2 is actually still a draft. HTML living standard actually already refers to SVG v2 – https://html.spec.whatwg.org/multipage/embedded-content-other.html#svg-0 – which is why `<use href>` in inline-svg inside HTML is valid, but otherwise not. In other words: I need to double check if we should differentiate between different cases.
  13. Garvin Hicking commented on patch set 5 CR 0 V 0 01/28/26, 17:39

    Reply Unresolved

    Thanks for the headsup, I did not catch that
  14. Benni Mack uploaded patch set 6 CR -1 V +1 11/11/26, 11:05

  15. Benni Mack commented on patch set 6 11/11/26, 11:05

    Rebased onto current main and reduced the scope according to the -1 on PS5:$\n$\n* Only the sprite icon markup is changed. It is always rendered as inline SVG in HTML documents, where SVG 2 applies and `<use href>` is valid.$\n* Standalone SVG files keep `xlink:href`, as SVG 1.1 requires it. This means the SVG sanitizer fixtures (CleanSVG/DirtySVG use.svg, useDos.svg) are no longer touched, as they represent uploaded files, and SvgDocumentFactoryTest still tests stripping remote `xlink:href`.$\n* BitmapIconProvider is left as is, its `<image xlink:href>` is part of a standalone SVG 1.1 document.$\n$\nCommit message adjusted accordingly.
  16. Benni Mack commented on patch set 6 11/11/26, 11:06

    (Reposting, the previous comment lost its line breaks.) Rebased onto current main and reduced the scope according to the -1 on PS5: * Only the sprite icon markup is changed. It is always rendered as inline SVG in HTML documents, where SVG 2 applies and `<use href>` is valid. * Standalone SVG files keep `xlink:href`, as SVG 1.1 requires it. This means the SVG sanitizer fixtures (CleanSVG/DirtySVG use.svg, useDos.svg) are no longer touched, as they represent uploaded files, and SvgDocumentFactoryTest still tests stripping remote `xlink:href`. * BitmapIconProvider is left as is, its `<image xlink:href>` is part of a standalone SVG 1.1 document. Commit message adjusted accordingly.
  17. core-ci voted on patch set 6 V +1 11/11/26, 11:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114060