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

Re: SVG - DOM function calls not working in FireFox 1.5b2

From: Andreas Neumann <neumann@karto.baug.ethz.ch>
Date: Fri, 28 Oct 2005 19:39:04 +0200
Message-ID: <43626238.5070907@karto.baug.ethz.ch>
To: Bebs Berteh <berteh@hotmail.com>
CC: www-svg@w3.org

Hi Bebs,

the code you suggest below is "non-standard" and not supposed to work in 
standards-compliant browsers. Just try the same thing without the "get" 
and use it as a property and not as a method, then your code should 
work. Adobe had the getXX methods to enable scripting in old Netscape 4, 
as far as I know.

Bebs Berteh wrote:

>
> Hello,
>
> I'd like to access the "uncles" elements of a give element in an svg 
> file using DOM tree with javascript; the 2 following calls don't work, 
> in both cases "element" is a "svg:group" node.
>
> var uncles = ((element.getParentNode()).getParentNode()).getChildNodes();

correct code would be:

var uncles = element.parentNode.parentNode.childNodes; //its even 
shorter code and more convenient to use.

The methods and properties listed f.e. at 
http://www.carto.net/papers/svg/manipulating_svg_with_dom_ecmascript/ 
should work in all SVG viewers.

Please also have a look at the following document for correct SVG authoring:
http://www.jwatt.org/svg/authoring/

Good luck,
Andreas
Received on Friday, 28 October 2005 17:33:03 GMT

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