Re: changes in USE elements

Hi there,

> JL> it's
> JL> with the USE element,  USE references foo.svg#MyRect, the copy is 
> live, so
> JL> any changes in foo.svg#MyRect need to be reflected in the USE 
> copy, this
> JL> makes sense.
>
> Yes.
>
> JL> However if there are 2 foo.svg#MyRect in the DOM, which is used?
>
> Duplicate ids? How can there be two?

Consider this:

<svg>
   <image xlink:href="foo.svg" ... />
   <image xlink:href="foo.svg" ... />
   <use xlink:href="foo.svg#rect" ... />
</svg>

Well, I see two questions now.

Question (a), I import twice the same SVG image in my document, in 
different locations. Granted it would be better done to put this image 
in a <defs> section in my document and reference it multiple time 
through references to the <defs> section. However, what happens if I 
have two <image> elements that point to the same external SVG file that 
has elements with an "id"? My understanding was that the DOM of these 
images were actually separate to that of the document (hence the need 
for the SVGImageElement::getSVGDocument() method), I may of course be 
wrong. In that case what happens, is there an error raised saying I 
have ID clashes?

Question (b) In the case where I don't have an id clash because of the 
multiple DOMs, suppose I make a change within the foo.svg image #1, 
what happens then? Is my <use> synchronized with the changes made in my 
referenced element? Is the image #2 version of that referenced element 
get synchronized element?

Hopefully there is an id clash and then the <defs> method would be the 
right one for this case (and a less confusing one too).

Antoine
-- 
Antoine Quint <antoine.quint@fuchsia-design.com>
SVG Consultant & Research Engineer, Fuchsia Design
W3C SVG Working Group Invited Expert

Received on Thursday, 26 June 2003 06:34:47 UTC