Details
-
Bug
-
Status: Resolved
-
Resolution: Incomplete
-
1.5
-
None
-
None
-
Operating System: All
Platform: PC
Description
I have SVG documents with the default namespace set to svg's namespace
(xmlns="http://www.w3.org/2000/svg"); when the following ecmascript function is
used:
function addRectangle() {
rectangle = document.createElement("rect");
rectangle.setAttribute("x", "20");
rectangle.setAttribute("y", "20");
rectangle.setAttribute("width", "100");
rectangle.setAttribute("height", "100");
rectangle.setAttribute("style", "fill:white; stroke:black");
document.documentElement.appendChild(rectangle);
}
the canvas is not updated, though the node is created. When the following
function is used:
function addRectangle() {
rectangle = document.createElementNS("http://www.w3.org/2000/svg","rect");
rectangle.setAttributeNS(null, "x", "20");
rectangle.setAttributeNS(null, "y", "20");
rectangle.setAttributeNS(null, "width", "100");
rectangle.setAttributeNS(null, "height", "100");
rectangle.setAttributeNS(null, "style", "fill:white; stroke:black");
document.documentElement.appendChild(rectangle);
}
it doesn't work. Since my default namespace is set to svg, I expected batik to
understand that my new "rect" element was a svg element to be put in the GVT
tree... But maybe I'm wrong, if so, please explain me why. (BTW, the first code
snippet works in Adobe SVG viewer...)