ComputedStyle
set to all elements, but it causes SVG use
element can't override reference object style, so generate wrong style image.
#440
Labels
Expected Behavior
I'm trying to get a snapshot of a SVG element that used some SVG
use
.Current Behavior
Above the button is the source SVG image, you can see it have different color.
Below the button is the image generated by html-to-image, it lost all custom colors.
Possible Solution
After I debug the libs source code with my code, I found the reason, that is the
ComputedStyle
been set to circle element which is a base element will be used to other places,stroke
andfill
been set tonone
in style, so even thoughuse
element has written those styles to override, but it doesn't work.Steps To Reproduce
Here is a sample code, you can try to convert this to image use
html-to-image
lib.Here is
cloneNode
content that I got by debug. You will find itstroke
andfill
have been set tonone
onpolyline
element.As you see, I should reuse
circle
to draw a line and use it in mask to implement dash effect. So, I can't give a constraint stroke value tocircle
.Additional Context
I think it's a common problem if someone use SVG
use
element to override any style, it should not be worked.Your Environment
The text was updated successfully, but these errors were encountered: