W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

indexOf in DOM Core L3

From: Jonas Sicking <sicking@bigfoot.com>
Date: Tue, 29 Jan 2002 01:28:47 +0100
Message-ID: <004501c1a85b$eb2efce0$b3e0d0d9@telia.com>
To: <www-dom@w3.org>
Cc: "Johnny Stenback" <jst@netscape.com>

There is one thing i've been missing in the DOM Core interfaces since I
started using the DOM implementation in Mozilla (for example when
implementing the DOM TreeWalker and the mozilla XSLT implementation). It
would be usefull with a way to get the index of a node withing a NodeList or
a NamedNodeMap. This could of course be done by simply iterating the
children until the right one is found, however this can probably be done
much faster as an internal method inside the NodeList/NamedNodeMap.

So I propose the following method on the NodeList and NamedNodeMap

  unsigned long indexOf(in Node item)

  returns the index if the node item
  raises NOT_FOUND_ERR if item is not contained in the

A similar method exists on some of the internal interfaces in mozilla and is
rather commonly used, however it would be nice to not have to rely in
internal interfaces and be able to use standard DOM interfaces instead.

/ Jonas Sicking
Received on Monday, 28 January 2002 19:24:11 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:09 UTC