Reputation: 23
I'd like to get width
of dynamically created text SVG node. Here's my code snippet.
var textSvgElement = document.createElementNS('http://www.w3.org/2000/svg','text');
textSvgElement.setAttribute('style', '12px');
textSvgElement.setAttribute('x', '10');
textSvgElement.setAttribute('y', '20');
textSvgElement.appendChild(document.createTextNode('some text'));
var textSvgElementDataObj = textSvgElement.getBBox();
But textSvgElementDataObj
variable always contains object with zero-valued properties like on image:
Could anyone give me some pieces of advice how to resolve this problem?
Upvotes: 1
Views: 639