W3C home > Mailing lists > Public > www-svg@w3.org > January 2010

removeChild and <use> question

From: Patrick Dengler <patd@microsoft.com>
Date: Tue, 12 Jan 2010 19:59:00 +0000
To: "www-svg@w3.org" <www-svg@w3.org>
Message-ID: <4A2DB3AE4504E944AF122BBFBA7FBA1F3E77D7BF@TK5EX14MBXC112.redmond.corp.microsoft.com>
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 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:44 GMT