- From: Ray David Whitmer <ray@jhax.net>
- Date: Mon, 25 Sep 2006 06:23:57 -0600
- To: Master Br <master@sitesbr.net>
- Cc: www-dom@w3.org
Master Br wrote: > Hi, everybody > I use only Mozilla Firefox for almost 2 years, and I noticed that it's > javascript sees more childNodes than other browsers, because it > considers textnodes and commentnodes too... > > It would be good if W3C Standards had *2 groups of methods* to deal > with nodes: > > In the Basic group, *firstChild, lastChild and childNodes[n]* as "most > browsers do", should deal ONLY with ELEMENT NODES... ignoring the rest > In a Special group, (for instance:) *firstChildSp, lastChildSp and > childNodesSp[n]* would return ALL TYPES OF NODES. > > This way,* ONLY if a programmer is interested in all nodes, including > the textnodes *(that in general only disturb the process) he will use > the special functions that end with "Sp" an return ANY type of nodes. > > Sp meaning Special, because it will consider textnodes, elementnodes > and commentnodes... > > In the Basic group, *firstChild, lastChild and childNodes[n]* as "most > browsers do", should deal ONLY with ELEMENT NODES... ignoring the rest I agree that dealing with element content is a very common use case, and the first thing I do when writing an XML app is a filter method or two that skips non-element content. I believe that this was the purpose of the traversal API, to be able to more-easily traverse for this sort of use case. I do not really know how practical it is to add APIs in the base for all such cases, even the common ones like element content. I do not know any more (at this point, because it has been so long since I looked at it) how well traversal addresses this use case or whether having the extra object around was too big of a problem, because I have never been confident enough that traversal API was present in a particular implementation to try it. Ray
Received on Monday, 25 September 2006 13:16:00 UTC