The width seems to be zero (or null) always for an svg:text tspan element in Firefox & Safari.
The jQuery functions width() and height() returns 0 for SVG tspan text elements in Firefox 11 and IE 9. In both Chrome 17 and 19 they work as expected. I have also tried usinf offsetWidth & getComputedTextLength() both returns 0 or null.
this is my query code:
$('svg #aitext-2-front-middle').find('tspan').each(function(i){
var currWidth = $(this).width();
console.log(currWidth);
});
This is the svg part:
<text id="aitext-2-front-middle" transform="matrix(1 0 0 1 81.7744 155.248)">
<tspan x="66.287" y="57.6" font-family="'MyriadPro-Regular'" font-size="12">lightweight UIs using </tspan>
<tspan x="39.72" y="72" font-family="'MyriadPro-Regular'" font-size="12">Adobe Illustrator CS5 (or above) </tspan>
<tspan x="40.146" y="86.4" font-family="'MyriadPro-Regular'" font-size="12">along with some free resources. </tspan>
<tspan x="79.385" y="100.8" font-family="'MyriadPro-Regular'" font-size="12">Let’s get started.</tspan>
</text>