- From: Erik Dahlstrom <ed@opera.com>
- Date: Wed, 13 Jan 2010 15:06:42 +0100
- To: "Patrick Dengler" <patd@microsoft.com>, "www-svg@w3.org" <www-svg@w3.org>
On Tue, 12 Jan 2010 20:59:00 +0100, Patrick Dengler <patd@microsoft.com>
wrote:
> 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.
The 'use' element is still in the DOM tree, as can be seen in the
Dragonfly debugger (Opera), and I see the same in Firefox using the
Firebug debugger.
> Is this the correct behavior?
The expected behavior is the same as the case where a 'use' points to a
non-existant id (there's nothing to draw, so in the below example you'd
see only the default browser background).
> <?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>
Cheers
/Erik
--
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed
Received on Wednesday, 13 January 2010 14:03:43 UTC