W3C home > Mailing lists > Public > www-svg@w3.org > February 2005

Re: getElementById method on SVGSVGElement

From: Robin Berjon <robin.berjon@expway.fr>
Date: Mon, 07 Feb 2005 10:30:56 +0100
Message-ID: <42073550.6010409@expway.fr>
To: Thomas DeWeese <Thomas.DeWeese@Kodak.com>
Cc: www-svg@w3.org

Thomas DeWeese wrote:
>    Well, it would seem to me that the restriction is that duplicate
> id's are not allowed on any two Elements that can be reached via
> the DOM tree traversal methods (getParentNode, firstChild, nextSibling, 
> etc).  If the node is in the document then all of it's
> nodes are reachable from all other nodes in the document and thus
> the id's in the SVG element's subtree must not duplicate any in the
> rest of the document tree.  I don't think this part is any different
> from the behavior of any existing conforming DOM implementation.

Do you have a reference for this? I couldn't find anything in the DOM 
allowing (or forbidding) such behaviour. Nodes that aren't attached to 
the hierarchy still belong to the document. I could well see an 
implementation that doesn't check to see if a node is attached or not 
before indexing IDs in a global ID table (in fact I know of at least one 
that does that).

In fact, if I read DOM 3 Core correctly, the attachement of the node to 
the tree appears to be irrelevant. If you look at the spec, the isId 
field on Attr says "when it is [of type ID] and its value is unique, the 
  ownerElement of this attribute can be retrieved  using the method 
Document.getElementById"[0]. Based on that, I would expect that given 
element 'el' not attached to the tree but belonging to document 'doc' 
and having an attribute 'foo' of value 'bar', if I did 
el.setIdAttribute('foo', true) it appears to be expected that 
doc.getElementById('bar') would return el.


Robin Berjon
   Research Scientist
   Expway, http://expway.com/
Received on Monday, 7 February 2005 09:31:02 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:02 UTC