I am trying to add image to SVG with Bobril, but this code doesn't work:
{
tag: 'svg',
children: {
tag: 'image',
attrs: {
'xlink:href': 'https://raw.githubusercontent.com/Bobris/Bobril/master/logo.png',
x: 0,
y: 0,
width: 200,
height: 200
}
}
}
Image tag is added to the page, but no image is shown. When I copy the element in Chrome's DevTools and paste it once again, the image is shown. What am I doing wrong?
Instead of 'xlink:href' use just href.
xlink:href is deprecated since SVG 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With