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

adding DocumentFragment to a Node

From: Deke Smith <deke@tallent.com>
Date: Tue, 3 Nov 98 15:26:12 -0600
To: "DOM List" <www-dom@w3.org>
Message-ID: <1302015725-11881211@tallent.com>
I have an implementation question about inserting a DocumentFragment Node 
into another Node.

My apologies if this has been discussed before.

I do not know what to return as the value for the methods which insert 
Nodes when the Node being added is a DocumentFragment. The 
DocumentFragment is not added into the Node, its content is. That content 
can be multiple Nodes at the "root" level of the DocumentFragment.

The return value should be the Node added. Since, after being inserted 
into another Node the DocumentFragment no longer exists, what is 
returned? 

From the description of Node.insertBefore in the DOM spec:

"If newChild is a DocumentFragment object, the entire contents of the 
document
fragment are moved into the child list of this node."

and later:

"Return Values
     The node being inserted."

Thanks,

Deke



-----------------------------------------------------------------
Deke Smith
Tallent Communications Group, Brentwood TN
deke@tallent.com, 615-661-9878
-----------------------------------------------------------------
" The best way to predict the future is to invent it. " 
       - Alan Kay 
Received on Tuesday, 3 November 1998 16:26:18 GMT

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