getElementsByTagNameNS

Hi.

I've noticed some discussions about the getElementsByTagName[NS] method on
this list some time ago (may 2001), but it's not clear to me what is the
position of the WG to this respect. Is the method going to change name (or
to be split into getDescendants... getChildren...)? Does the WG feel that
the method is OK as it is now? Have I missed something in the level 3
spec?

Apart from performances considerations, it seems weird to me that a
general method like getElementsByTagNameNS is provided, where it can be
implemented by having something like getChildrenByTagNameNS which is
soo much simpler. What is therationale for having the former one?

Another thing related to that. Quoting an email from that period, about
the efficiency of an hypothetical getChildrenByTagNS versus iterating the
children NodeList and comparing explicitly namespaces and local names:

> the cost of looking for this themselves by walking the list of children
> is minor and there is little hope the implementation can do better. 

In DOM namespace comparison implies string comparison, which can be quite
inefficient if done for a large number of nodes, and given that namespaces
URIs are usually quite long. Thus, having a getChildrenByTagNameNS can be
faster than iterating thru all the children and comparing explicitly the
namespace, since the internal representation of namespace information
usually relies on some _unique_ structure and the namespace is represented
by the reference to such structure. Comparing pointers (internally =>
NodeList implementation) is certainly faster than comparing strings
(externally => user code).

Any comment to this would be greatly appreciated.

Regards,

	luca

Received on Friday, 19 April 2002 18:39:14 UTC