RE: Node::normalize behaviour

> -----Original Message-----
> From:	Tobias Peters [SMTP:t-peters@gmx.de]
> Sent:	Sunday, November 04, 2001 2:26 AM
> To:	www-dom@w3.org
> Subject:	Node::normalize behaviour
> 
> Node::normalize can reduce the number of Text nodes present in a document.
> What is supposed to happen with these text nodes?
> 
	I believe this is explained clearly enough in the W3C recommendation:

	http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#method-normalize

	In short the character data of adjacent Text nodes is merged into a single node.

> Would a DOM implementation be comformant if it removed all adjacent
> Text nodes as with removeChild, and inserted a new Text node with the
> combined content in their place?
> 
	I believe so. As long as the operation does what is described in the recommendation. In DOMC I did DOM_CharacterData_insertData followed by DOM_Node_removeChild recursively on adjacent Text
nodes. The effect is the same.

> By the way, what should happen with registered event listeners or DOM
> level 3 user data on the original individual text nodes?
> 
	I don't know about DOM level 3 user data but event listeners must not be triggered after a node is removed. I suppose if the character data of one node is inserted into the other (as I
describe DOMC does) a listener registered on the remaining node would survive and therefore continue to have the potential to be triggered. But I'm not sure what sort of events would be triggered by a
Text node considering they do not have children and are rather benign. Also, normalize would typically be called before or after processing of the DOM and not on the middle of Events being fired. But
you never know.

	Mike

Received on Sunday, 4 November 2001 19:15:42 UTC