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

SVG use element and cycles

From: Chad Faragher <wyck@chromium.org>
Date: Tue, 16 Mar 2010 14:37:44 -0400
Message-ID: <d85907821003161137y5b8dcec9h75f432dc89175d02@mail.gmail.com>
To: www-svg@w3.org
In SVG, the <use> element can be used to create a cycle by linking to a
parent node.  Is this allowed?  How should it be handled?

For example, here is a specific test case that is giving me some trouble.

<svg xmlns="http://www.w2.org/2000/svg">
<g id="foo">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xl="
http://w3.org/1999/xlink">
<use xl:href="#foo"/>
<g id="bar" />
<use xlink:href="#bar"/>


[ Note that the first <g> tag is a start-tag, and not an empty-tag ]

First of all, it is not well formed xml, so that's perhaps reason enough to
reject it.  But even if it were well-formed XML the structure of it is
strange -- I have a problem with the idea of having a <use> element refer to
its own grandparent element.  This would case a cycle in my mind, and should
probably be disallowed.

What does the spec have to say about the validity of this, and specifically
the potential cycles that would be created by having a <use> element refer
to one of its ancestor nodes?

- Chad
Received on Thursday, 18 March 2010 08:14:58 GMT

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