Skip to content

Add tests for SVG foreignObjects being cloned by reference with use#59127

Open
MaPePeR wants to merge 2 commits intoweb-platform-tests:masterfrom
MaPePeR:svg-use-foreignObject-clone-by-reference
Open

Add tests for SVG foreignObjects being cloned by reference with use#59127
MaPePeR wants to merge 2 commits intoweb-platform-tests:masterfrom
MaPePeR:svg-use-foreignObject-clone-by-reference

Conversation

@MaPePeR
Copy link
Copy Markdown

@MaPePeR MaPePeR commented Apr 12, 2026

This is an extension of #55576 by @Psychpsyo, which added a test to allow foreignObject inside use elements.

This PR adds two more test for foreignObject and use behavior:

  • use-foreignObject-with-restyle.html tests if changing the background color of a div inside a foreignObject, that is duplicated with use, changes the background color for all clones.
    • This test passes in Firefox, but fails in Chrome (blue), because there foreignObject is not yet supported for use at all.
  • use-foreignObject-with-canvas.html tests if a canvas inside a foreignObject, that is duplicated with use, is rendered multiple times.
    • This test fails in Firefox (red) and Chrome (blue).

I tried to write the tests in a way, that it fails with blue color, when foreginObject inside use is not supported at all and only fail with red, when the restyle isn't applied or the canvas content isn't rendered. I hope that is the intended usage of the different colors.

The behavior of the restyle test in Firefox is also kind of an indication to me, that the canvas test should also pass, because it means, that the foreignObject clones are not independent copies, but are linked.
I don't think the spec is actually clear on what is supposed to happen, but I'd argue the expected behavior is the only one that is useful.

(Sadly I was not able to run the tests locally, because a Windows update broke my WSL 🙄😞.)

@MaPePeR MaPePeR force-pushed the svg-use-foreignObject-clone-by-reference branch from 559f360 to 3396447 Compare April 12, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants