W3C home > Mailing lists > Public > www-dom@w3.org > July to September 1998

Re: Should Document.cloneNode() work in Level 1?

From: Ray Whitmer <ray@imall.com>
Date: Tue, 08 Sep 1998 19:15:01 -0600
Message-ID: <35F5D695.E5E902A9@imall.com>
To: www-dom@w3.org
Don Park wrote:

> >newDoc.createCopy(node, false); // for a shallow copy
> >newDoc.createCopy(node, true); // for a deep copy
>
> I have no problem with this proposal particularly because it shifts the
> responsibility of copying to the destination document.  It feels right.

I would prefer a method at the doc level, but one which has the option of
either cloning if the document is incompatible or transforming it if the
documents are compatible.  Only the retured node and not the original
would be usable after the operation.

I would call this transferNode(node) // always a deep transfer.

Actually, given my current model's shared underlying data model, I can
clone faster than I can mutate the original reference to have new
ownerDocuments, since clones share the original data.  I only prefer this
other approach to allow other implementations to efficiently transfer
documents between compatible implementations.  If no one else wants it,
fine.

I didn't hear opinions whether document.cloneNode(deep) should clone the
document itself or raise an exception.  This is quite different from both
cloneNode or transferNode on a child, because it creates a new
ownerDocument rather than confining to or transferring between existing
ownerDocument's.  I think we need something like cloneNode to work at the
document level.

Ray Whitmer
Received on Tuesday, 8 September 1998 21:14:39 GMT

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