W3C home > Mailing lists > Public > www-dom@w3.org > April to June 1999

Re: Detecting positional elements

From: Steve Oldmeadow <smo@jst.com.au>
Date: Tue, 13 Apr 1999 16:35:13 +0800
Message-ID: <00c801be8588$956938a0$0201a8c0@pikachu>
To: <www-dom@w3.org>
NOTE: These methods are only valid if the document is locked from
modification while you are doing the traversal.

To determine the depth of a node in the tree you can traverse the nodes
returned by getParentNode() until the method returns null and count how many
ancestors the node has.

To determine the ordinal position of a node within its siblings you can do
the same thing but call getPreviousSibling() instead of getParentNode().
You may find the result more meaningful if you only count nodes that are
elements.

Steve Oldmeadow
Justice Systems Technologies


-----Original Message-----
From: Wolfgang Belau <Wolfgang.Belau@ri.dasa.de>
To: www-dom@w3.org <www-dom@w3.org>
Date: Tuesday, 13 April 1999 4:07
Subject: Detecting positional elements


>Is there a way of detecting the positional location of a specific
>element?
>
>Such a feature would be of interest for certain applications, where one
>likes to position certain elements in relation to the position of other
>elements.
>
>
>best regards,
>
>
>Wolfgang Belau
>
>--------------------------------------------------------------------------
>Wolfgang Belau Phone:  +49 421 539 4519
>DaimlerChrysler Aerospace AG Fax:    +49 421 539 4529
>Space Infrastructure Division (RIO61) E-mail: Wolfgang.Belau@ri.dasa.de
>Huenefeld Str. 1-5
>P.O.Box 28 61 56
>D-28199 Bremen, GERMANY
>--------------------------------------------------------------------------
>
Received on Tuesday, 13 April 1999 04:37:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT