Closed
Bug 373252
Opened 18 years ago
Closed 18 years ago
getComputedTextLength() returns 0 from SVG onload handler
Categories
(Core :: SVG, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 293581
People
(Reporter: duncan.loveday, Unassigned)
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
<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>.
Reporter | ||
Comment 1•18 years ago
|
||
Reporter | ||
Comment 2•18 years ago
|
||
Comment 3•18 years ago
|
||
Same issue as bug 293581 with the same workarounds.
Reporter | ||
Comment 4•18 years ago
|
||
Thanks Robert, I've marked this as a duplicate.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•