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

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 UTC