User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:184.108.40.206) Gecko/20061204 Firefox/220.127.116.11 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:18.104.22.168) Gecko/20061204 Firefox/22.214.171.124 <text element>.getComputedTextLength() for a non-empty <text element> returns 0 when called from an SVG onload event handler. <text element>.getComputedTextLength() on the same <text element> returns valid data when called from an HTML onload handler or from mouse event handlers called after the load process has completed. Reproducible: Always Steps to Reproduce: 1. Place the attached test.html and test.svg files in a temporary directory 2. Open the attached test.html file in Firefox 3. Actual Results: The alert messages displayed are "loadSVG()" "textLen=0" "loadHTML()" "textLen=99" Expected Results: The alert messages expected are "loadSVG()" "textLen=99" "loadHTML()" "textLen=99" This bug (if indeed it is a bug) can be worked around by using the SVG onload event handler to save a reference to the SVG document and calling the remainder of the code from the HTML onload handler, or by parsing the SVG content programatically (with DOMParser.parseFromString()) and adding the root element to the HTML document directly so that the root element can be obtained without the use of an SVG onload handler. The same result is observed when including the SVG content via an <EMBED> tag instead of <OBJECT>.
Same issue as bug 293581 with the same workarounds.
Thanks Robert, I've marked this as a duplicate.