Re: use element and invalid refence

The specification section on `<use>` does require a re-write, but I think
this is a pretty clear bug.  The link to referenced content is supposed to
be "live", reflecting all changes in the referenced element.  That should
include removing it completely!

In contrast, in Chrome currently, removing the original element seems to
sever all links to the copy.  Other changes (before removing) are correctly
propagated.

Try the following script in
http://www.w3.org/TR/SVG11/images/struct/Use01.svg

var r = document.querySelector("defs rect");
r.setAttribute("fill", "blue");
r.parentNode.removeChild(r);
   /* required for IE, which doesn't support Element.remove() */
r.setAttribute("fill", "red");
document.querySelector("defs").insertBefore(r, null);


The final result should be a copy of a red rectangle, but in Chrome it
stays blue.  Probably the event listeners they are using to respond to
changes in the original are not picking up the DOM modification.

AmeliaBR


P.S.  I'm pretty sure the SVG linked above is the test case you were
playing around with.  (The one you linked to was about gradients).

Received on Thursday, 16 April 2015 14:20:02 UTC