Letractively / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

cannot change an svg element attributes in IE(8) after moving parent div to an other place in the docuement #366

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a svg document (inline script or embeded object) inside div#source
2. remove div#source from its parent an insert it in div#insert
3. access a SVG Element inside the document an try to rotate it by calling
elem.setAttribute( "transform", "rotate( 30, 100, 100 )" ); for instance.
(setAttributeNS( null, ..., ... ) has the same result)
4. IE throws an error basically saying that setAttribute does not exist.

What is the expected output? What do you see instead?

I Tested with Firefox3.5 this works properly in both native and flash
renderer mode:

No Js Error and element is rotated.

What version of the product are you using? On what operating system,
browser, and version of Flash?

Svgweb: svgweb-2009-10-12-Beholder
OS: Vista Home Premium 64bits
Flash: 9

Please provide any additional information below. Reduced test cases are
always appreciated!

Test Case:

<html>
<head>
<!-- initialize svg web -->
</head>
<body>

<!-- insertion point --> 
<div id="insert">
</div>

<!-- source fragment which will be moved to insert point -->    
<div id="source">
    <script type="image/svg+xml">   
        <svg width="200" height="200"  >
            <line id="elem" x1="100" y1="50" x2="100" y2="100"
style="stroke:#000000;" />
        </svg>
    </script>
</div>

<!-- test script -->
<script>
window.onload = function() {
    var source = document.getElementById('source');
    var parent = source.parentNode;
    parent.removeChild( source );
    var insert = document.getElementById('insert');
    insert.appendChild( source );
    var elem = document.getElementById('elem');

    elem.setAttribute( "transform", "rotate( 30, 100, 100 )" );
}
</script>
</body>
</html>

Original issue reported on code.google.com by guillaum...@gmail.com on 25 Oct 2009 at 5:38

GoogleCodeExporter commented 8 years ago
Let me describe my use case a little more:

I need to show some gadgets which content is rendered in svg (thanks to your
excellent framework, beside this issue :) )
The gadgets need to add some presentation elements around the svg document 
(title
bar, window like frame and so on) using any JavaScript framework widget, which 
is why
I need to remove them from their original place to insert them into whatever
JavaScript will have generated.
I cannot render the presentation elements before, hard coded in HTML, since 
they are
generated on window.onload.(think GWT widgets, dojo widgets, jquery widgets ...)

Original comment by guillaum...@gmail.com on 25 Oct 2009 at 6:05

GoogleCodeExporter commented 8 years ago
We don't support removing SVG root nodes or SVG OBJECTs from their parent, like 
you
do with the DIV. You must remove just the SVG root node or SVG OBJECT using
svgweb.removeChild. This is an unfortunate limitation necessary since we don't 
want
to hijack the HTML machinery which would be necessary to know if any HTML node 
has
nested SVG content. See here for instructions on svgweb.removeChild:

http://codinginparadise.org/projects/svgweb/docs/UserManual.html#dynamic

Part of that is unimplemented, which I am working on this week in Issue 202, 
which
includes svgweb.removeChild for SVG roots.

This bug is a candidate for closing WONTFIX.

Original comment by bradneub...@gmail.com on 27 Oct 2009 at 9:48

GoogleCodeExporter commented 8 years ago

Original comment by bradneub...@gmail.com on 27 Oct 2009 at 9:48

GoogleCodeExporter commented 8 years ago
Like I mentioned, you must use svgweb.removeChild. Marking this bug INVALID.

Original comment by bradneub...@gmail.com on 5 Nov 2009 at 11:53