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

>As for Document.createCopy, this seems distinctly non-OO.
>Wouldn't it require the document to test what kind of node...

The various node types probably would take responsibility for copying their
local data anyway.

If you start copying a tree, _someone_ is going to have to dispatch to the
appropriate factory methods based on the DOM type of the source node. That
dispatch is going to want to loop back through the Document's factories to
obtain the new nodes, in case the DOM's user has subclassed a node type and
subclassed Document to override the factory to produce that modified node.
So there's something to be said for making the "produce our version of one
of these" mechanism live in Document; it is a factory, albeit of a
build-to-order flavor.

Level 1 declared that multiple documents weren't supported, so all of this
is probably going to be deferred to Level 2. Which is fair... but which
probably means Document.cloneNode() should be _explicitly_ undefined in
Level 1.

______________________________________
Joe Kesselman  / IBM Research
Unless stated otherwise, all opinions are solely those of the author.

Received on Wednesday, 9 September 1998 09:13:35 UTC