W3C home > Mailing lists > Public > www-svg@w3.org > July 2000

Getting document's root element

From: Steve Dickson <sdickson@savagesoftware.com>
Date: Thu, 13 Jul 2000 15:22:12 -0700
Message-id: <fc.0085846d0000af1f0085846d0000af1f.af2c@savagesoftware.com>
To: www-svg@w3.org
In the spec of 2000/03/03, SVGDocument::rootElement is defined in section
6.10 as "the closest ancestor 'svg' element.  If this element is an
outermost 'svg' element (i.e. either it is the root element of the
document or if its parent is in a different namespace), then this
attribute will be null".  How then can the user get a handle on the
document's root element?  I'm thinking of the situation where a user is
accessing the SVG document using a script.  They can easily get a handle
on the SVGDocument itself, but there doesn't seem to be a way to get a
handle on the document's root element as an SVGSVGElement.  They could
fake it by giving the root element a unique id and then calling
getElementById(), or by traversing the tree using DOM calls, but both of
these methods would return the root element as a DOM element, not as an
SVGElement.  There must be a way to retrieve the root element of an
SVGDocument as an SVGElement, but I can't find it.  Am I missing something
really obvious?
S.
Received on Thursday, 13 July 2000 18:22:19 GMT

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