W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

Re: Implementing Document.createElement, etc.

From: Don Park <donpark@quake.net>
Date: Thu, 8 Oct 1998 08:19:17 -0700
Message-ID: <002a01bdf2cf$06a5c080$2ee044c6@arcot-main>
To: "DOM list" <www-dom@w3.org>
>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?

hasChildNodes for both the element and the document will 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.

Newly created nodes can not be found by any of the methods used to traverse
the document tree.  getAttributes() also will not return newly created Attr

>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.


Don Park
Received on Thursday, 8 October 1998 11:19:44 UTC

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