indexOf in DOM Core L3

Hi,

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
interfaces:

  unsigned long indexOf(in Node item)
            raises(DOMException)

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


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