Re: Special group of functions for NON-ELEMENT nodes in document

I agree that the specification leaves too much room for maneuverability. 
Reading this, my mind immediately jumped to the whitespace nodes that 
developers dislike in Firefox. Currently, a call to node.firstChild can 
return the first 'tag' child node, or a text node containing a carriage 
return, with the same document but a different implementation of the DOM.

The Firefox discussion is here:
https://bugzilla.mozilla.org/show_bug.cgi?id=26179

I'm not automatically agreeing with your solution but I would welcome a 
discussion on this list since I don't fully understand the issues. Why 
is whitespace an optional part of a DOM tree, and on what grounds would 
an implementation make the choice to keep or discard them? Also, has 
anything been done or will anything be done to ensure that a DOM user 
can get consistent results regardless of implementation?

Best,
Matt

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
>
> What about ?
>
> Sergio A.

Received on Tuesday, 26 September 2006 09:37:18 UTC