W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

Comments and questions on text node interface

From: Stefan Wachter <Stefan.Wachter@gmx.de>
Date: Fri, 1 Mar 2002 16:06:50 -0500 (EST)
Message-ID: <3C7FED89.1070402@gmx.de>
To: www-dom@w3.org
Dear all!

I have comments and question regarding the following attributes/methods 
of the text node interface:

1. wholeText attribute:

What is the expected use case of this attribute? Shouldn't this 
functionality moved to the parent, because it is quite similar, to the 
textContent attribute of the node interface? If this functionality is 
really needed then I propose to have a method on node:

/**
 * Collects the text content of all logically-adjacent text nodes of the 
specified text node.
 */
public String getWholeText(int anIndex);   // alternatively: 
getWholeText(Text aTextNode)

2. replaceWholeText method

This method has a lot of tree-processing logic that should not be 
executed by a child node on its parent node. I would prefer the parent 
node to have control over the process. Therefore I propose a method on 
the node interface:

/**
 * Replaces the logically-adjactent text nodes always by a NEW text node.
 */
public Text replaceWholeText(int anIndex); // alternatively: 
replaceWholeText(Text aTextNode);

3. splitText method

To be consistent I would also move this method to the node interface too.

In general I think that the DOM core should not contain too much 
special-purpose functionalites like these once. In addition I assume 
that this attribute and these methods are meant for editing. Therefore 
they should be moved from the DOM core to the NodeEditAS interface.

--Stefan
Received on Wednesday, 13 March 2002 16:56:09 GMT

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