I'm trying to get the path length for the stroke of a SVG text element and I'm getting a path.getTotalLength is not a function
error in my console. When I look up getTotalLength
, I see that it's been depreciated? It looks like it has something to do with the shift from SVG1 to SVG2? Is this correct?
I'm trying to get the path length for the stroke of a SVG text element and I'm getting a path.getTotalLength is not a function
error in my console. When I look up getTotalLength
, I see that it's been depreciated? It looks like it has something to do with the shift from SVG1 to SVG2? Is this correct?
- I don't think it never did have this method... – Kaiido Commented Apr 4, 2017 at 6:01
- What do you think the total length of text is? How would you calculate it? – Robert Longson Commented Apr 4, 2017 at 7:13
1 Answer
Reset to default 5It has not been deprecated. In SVG 1.1, getTotalLength()
is only available on the <path>
element.
In SVG 2, which browsers are still in the process of implementing (so you can't rely on it yet), getTotalLength()
is available on all shape elements, but not including text elements.