- From: Deke Smith <deke@tallent.com>
- Date: Thu, 8 Oct 98 09:42:01 -0500
- To: "DOM list" <www-dom@w3.org>
I have a question about all of the Document.create... methods in the DOM spec. My current (mis)understanding is that when an element is created using Document.createElement that it is not yet part of the document hierarchy. If I have an empty Document object (where hasChildNodes() returns false) and I use createElement() to create a new Element object, does hasChildNodes() still return false? If so, this would have an interesting implication: these newly created nodes can node be found by any of the methods used to traverse the document tree, like Node.getChildNodes() in the Java implementation. And a Document object that is used to create an Attribute object with Document.createAttribute() would not return that Attribute when Node.getAttributes() is called in the Java implementation. My understanding is this: An Element node can be created using a Document and that Document would be the Element's ownerDocument (but not parent). Once an Element object is placed in the Document tree using a method like Node.appendNode(), then and only then would it appear as a child object of any other object. ----------------------------------------------------------------- Deke Smith Tallent Communications Group, Brentwood TN deke@tallent.com, 615-661-9878 ----------------------------------------------------------------- " The best way to predict the future is to invent it. " - Alan Kay
Received on Thursday, 8 October 1998 10:42:08 UTC