Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App instance cannot render inside larger SVG #2926

Closed
amw opened this issue Jan 2, 2021 · 2 comments · Fixed by #2929
Closed

App instance cannot render inside larger SVG #2926

amw opened this issue Jan 2, 2021 · 2 comments · Fixed by #2929
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. 🐞 bug Something isn't working

Comments

@amw
Copy link

amw commented Jan 2, 2021

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/

@dsseng
Copy link
Contributor

dsseng commented Jan 3, 2021

It's caused by runtime bug, not compiler. Here's the reproduction with render functions:
https://codepen.io/sh7dm/pen/VwKXzbK

@HcySunYang
Copy link
Member

We should avoid checking whether an element is SVG in processElement, which can avoid a lot of computational consumption. And again, I didn’t notice @edison1105 's PR because I’m coding, sorry...

@posva posva added 🐞 bug Something isn't working 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. labels Jan 4, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. 🐞 bug Something isn't working
Projects
None yet
4 participants