Closed Bug 368197 Opened 18 years ago Closed 18 years ago

"use" elements added via Javascript are not drawn

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: laserdog, Unassigned)

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1 Adding a "use" element (referencing a def in the same page) via javascript gets added to the DOM properly, but does not get drawn. Will add an example. Reproducible: Always The javascript I used: function init() { var newUse = document.createElementNS(svgNS, "use"); newUse.setAttributeNS(svgNS, "id", "box2"); newUse.setAttributeNS(svgNS, "xlink:href", "#greenBox"); newUse.setAttributeNS(svgNS, "transform", "translate(100,100)"); var svgRoot = document.getElementById('svg-root'); svgRoot.appendChild(newUse); }
The previous example had an artifact from "Save As". Interestingly, in it it showed the added "use" element using "a0:href" instead of the "xlink:href" which firebug shows me... Which might be the problem.
Tor set me straight in IRC, my javascript code for setting the xlink attribute was wrong, should have been: newUse.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#greenBox"); instead. Works now. =)
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: