W3C home > Mailing lists > Public > www-svg@w3.org > December 2006

Scopes ?

From: Jeff Schiller <codedread@gmail.com>
Date: Thu, 30 Nov 2006 22:27:34 -0600
Message-ID: <da131fde0611302027r6df5defnd7392a124d8370df@mail.gmail.com>
To: www-svg@w3.org
Cc: adam@emiasys.com

> Hi!
> What should be the scope of:
> - getElementById() - SVG NS or all?
> If not all, how to get elements by id outside of the svg namespace?
> Regards
> Alexander Adam
> --
> Geschäftsführer / CEO

As per http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-getElBId,
this method is part of the Document interface.  Thus, this gives you
the child element of the Document object (i.e. the child within that
DOM).  If you want to get elements outside of the Document, then
you'll have to navigate to another Document Object Model.  This is
generally possible.

Read this article,

Specifically on Page 2, I get into how to navigate between DOMs in the
case of HTML and SVG integrated with the HTML:object entity.  I even
drew some pretty diagrams (in SVG, of course!).

In the case of XHTML containing inline SVG nodes,  then you would go
from the SVGDocument up to the parent Node in the HTML DOM:

- SVGDocument (http://www.w3.org/TR/SVG11/idl.html) inherits from Document
- Document (http://www.w3.org/TR/DOM-Level-2-Core/core.html#i-Document)
inherits from Node
- Node (http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247)
has a parentNode attribute

Once you've navigated to the other DOM, then you'd use
getElementById() method on the Document entity in that DOM.

Hope this clues you in.

Received on Friday, 1 December 2006 04:27:45 UTC

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