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

>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);

Don

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