W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2006

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

From: Matt Dockerty <matt@nistrum.co.uk>
Date: Tue, 26 Sep 2006 07:04:53 +0100
Message-ID: <4518C305.8070006@nistrum.co.uk>
To: Master Br <master@sitesbr.net>
CC: www-dom@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:58 GMT