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

Re: How can I put a DocumentFragment in a Document?

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Mon, 20 Nov 2000 12:32:52 -0500
To: "'www-dom@w3.org'" <www-dom@w3.org>
Message-ID: <OF0226E228.858EFDE0-ON8525699D.0060249F@pok.ibm.com>

A DocumentFragment can never be a child of any other node. If you try to
append or insert it, its _children_ are appended/inserted instead.

That convenience feature is the main reason DocumentFragment exists...

(Anticipating the next likely question: Remember that nodes belong to
specific Documents, and may only be appended to that Document. If the
DocumentFragment was created as part of one Document, you can _not_
directly append its contents to another Document; you need to use the
importNode method or some equivalent.)

______________________________________
Joe Kesselman  / IBM Research
Received on Monday, 20 November 2000 12:32:57 GMT

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