Re: Some specification clarification questions

Shawn Silverman wrote:
> 
> Hi all.  I was busy implementing the DOM level 2, and I came across a few
> issues which I felt weren't specified clearly (I probably missed
> something).  Here are my questions:
> 
> 1) in Node.replaceChild() and Node.removeChild(), since oldChild is
> returned, does it have its parent and siblings set to null, or will the
> user require knowing what this old node pointed to?

They are set to null.

[[[
nextSibling of type Node, readonly 
  The node immediately following this node. If there is no such node, this
  returns null.
parentNode of type Node, readonly 
  The parent of this node. All nodes, except Attr, Document, DocumentFragment,
  Entity, and Notation may have a parent. However, if a node has just been
  created and not yet added to the tree, or if it has been removed from the tree,
  this is null.
]]]

-- Document Object Model Core
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247
Thu, 09 Nov 2000 23:18:19 GMT


> 2) in Node.cloneNode(), for a non-deep copy, are the *references* to the
> children supposed to be copied as well?  Eg. if an Element has 3 children
> and we clone it (non-deep), will that new node have three children
> pointing to the original three children?

For a non deep copy, only the element and his attributes are copied. Childrens
are not included.

[[[
deep of type boolean 
  If true, recursively clone the subtree under the specified node; if false,
  clone only the node itself (and its attributes, if it is an Element).
]]]

-- Document Object Model Core
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247
Thu, 09 Nov 2000 23:18:19 GMT


Philippe

Received on Wednesday, 29 November 2000 15:01:54 UTC