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 12:57:30 -0700
Message-ID: <003101bddb62$ec33d620$2ee044c6@arcot-main>
To: <www-dom@w3.org>
>A better alternative would be to put this on Document rather than Node:
>  Node cloneNode(Node original, boolean deep)
>This would have a couple of advantages:
>  1. it would keep _all_ the node-creation methods on Document
>  2. it would not have to be modified or extended when new node types are
>     added.
>  3. there are no problems when the original node's document and the target
>     document use totally different implementation classes.

All nice and dandy except for the weird look code:

Document doc = node.getOwnerDocument();
doc.cloneNode(node, doc);
doc.cloneNode(node, null); // assuming null implies same doc
doc.cloneNode(node, someOtherDoc);

It just does not look as natural as:

Node newNode = oldNode.cloneNode(true, null); // for same doc
Node newNode = oldNode.cloneNode(true, someOtherDoc);

Received on Tuesday, 8 September 1998 16:06:51 UTC

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