Re: Node.ownerDocument property: always defined?

>The reason why Document nodes do not apply is that it is created by the
>parser engine, not a document.  A document is not owned by a document.

There isn't a really good reason that a Document isn't its own
ownerDocument; that's just the way it happened to get defined.

DocumentType is normally created before the document,  without knowing
which document it might be going into, and hence starts out with
ownerDocument being null. When you get around to using it as a parameter in
the createDocument method, its ownerDocument will be set and locked in.

All other nodes have their ownerDocument set before Document.create...()
returns.

See also http://www.w3.org/DOM/faq.html#ownerdoc



______________________________________
Joe Kesselman  / IBM Research

Received on Monday, 16 July 2001 10:29:03 UTC