Scopes ?

> 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,
http://dev.opera.com/articles/view/svg-evolution-not-revolution/

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.

Thanks,
Jeff

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