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

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

From: Don Park <donpark@quake.net>
Date: Tue, 8 Sep 1998 21:54:49 -0700
Message-ID: <005501bddbae$3f2d5590$2ee044c6@arcot-main>
To: <www-dom@w3.org>
I think there might be a very nice solution here somewhere.

How does this look?

We just add Document.transferNode(Node node) as Ray suggested and have the
user use Node.cloneNode() with it if he is cloning over to a new document.

Node originalNode; // this node is in the tree structure (parentNode !=
Document destinationDoc;

    // transfer a shallow clone

    // transfer a deep clone

    // transfer the original node


Don Park

-----Original Message-----
From: Ray Whitmer <ray@imall.com>
To: www-dom@w3.org <www-dom@w3.org>
Date: Tuesday, September 08, 1998 6:23 PM
Subject: 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,
>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 Wednesday, 9 September 1998 01:06:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:04 UTC