removeChild and <use> question

We've looked at the <use> and removeChild() together.  Specifically, what is supposed to happen to a 'use' instance when removeChild() is called on the parent of the element that's being use'd?

We see different behaviors across browsers. We think that both the original element and the 'use' instance should be removed. This is what Firefox and Opera do. Is this the correct behavior?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Full//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.1" baseProfile="full" id="svg-root" width="100%" height="100%" viewBox="0 -10 480 360" contentScriptType="text/javascript" onload="foo()">
    <script>
        function foo()
        {
            var gElem = document.getElementById("gElem");
            var rectElem = document.getElementById("rectElem");
            var useElem = document.getElementById("useElem");
            gElem.removeChild(rectElem);
        }
        

    </script>
<g id="gElem">
    <rect x="96px" y="96px" width="96px" height="96px" fill="green" id="rectElem" />
</g>
<use xlink:href="#gElem" x="96px" y="96px" width="96px" height="96px" id="useElem" />
</svg> 

Thanks in advance.

Patrick Dengler
Senior Program Manager, Microsoft
Internet Explorer

Received on Tuesday, 12 January 2010 19:59:41 UTC