Getting document's root element

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 UTC