W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

Re: adding DocumentFragment to a Node

From: John Cowan <cowan@locke.ccil.org>
Date: Wed, 04 Nov 1998 11:08:43 -0500
Message-ID: <36407C0B.7C054AC7@locke.ccil.org>
To: DOM List <www-dom@w3.org>
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 GMT

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