Re: adding DocumentFragment to a Node

Deke Smith wrote:

> If the DocumentFragment were inserted into a Node, it would be a Child of
> that Node.

Correct.

> Before being inserted, a DocumentFragment's children will point to the
> DocumentFragment as their parentNode. After the DocumentFragment has been
> inserted, its children would point to the Node the DocumentFragment was
> inserted to as their parentNode. The DocumentFragment would not be
> included in the child list of the Node it was inserted into, but the
> DocumentFragment's children would be.

Correct.
 
> This supposes that a Node cannot be in the child list of two different
> Nodes.

A sound assumption.
 
> The old DocumentFragment no longer exists [...].

Not so.  Just because its children have been removed and inserted
into their new location, does not mean the DocFrag has been destroyed.
Why should it be?  Just return it, now without children.

> What are the characteristics of a
> DocumentFragment if that is what is returned? The attributes childNodes,
> parentNode, previousSibling, and nextSibling would all be null.

Correct.

> The
> returned value from Node.insertNode() would not reflect what was actually
> inserted.

No, it wouldn't.  But that's all right; the spec says to return
newNode, not "what was actually inserted".  So return it.
 
-- 
John Cowan	http://www.ccil.org/~cowan		cowan@ccil.org
	You tollerday donsk?  N.  You tolkatiff scowegian?  Nn.
	You spigotty anglease?  Nnn.  You phonio saxo?  Nnnn.
		Clear all so!  'Tis a Jute.... (Finnegans Wake 16.5)

Received on Wednesday, 4 November 1998 11:07:34 UTC