Skip to content

App instance cannot render inside larger SVG #2926

Closed
@amw

Description

@amw

Version

3.0.5

Reproduction link

https://codepen.io/hisrootness/pen/GRjxNzL

Steps to reproduce

  1. Use createApp to encapsulate a <g> element with children representing SVG shapes.
  2. Mount the app inside an existing <svg> element.

What is expected?

The nodes added by Vue app to the parent SVG image should be instances of SVGElement and should be able to affect the drawing.

What is actually happening?

The app nodes are added to DOM, but they are not instances of SVGElement and they don't draw anything on the parent SVG image.


In Vue2 I was able to add my component to existing SVG image (not created by Vue). In Vue3 SVG rendering only seems to work when the <svg> element itself is rendered by the Vue instance.

Here is example when the drawing works (the only difference from repro is that id="app" is above the <svg> element instead on it):
https://codepen.io/hisrootness/pen/MWjVbLJ

And here is an example showing that it used to work in Vue 2:
https://jsfiddle.net/hisrootness/7nkob98v/1/

Metadata

Metadata

Assignees

No one assigned

    Labels

    🍰 p2-nice-to-havePriority 2: this is not breaking anything but nice to have it addressed.🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions