W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2001

Re: Node.ownerDocument property: always defined?

From: Jeff Yates <PBWiz@mail.pbwizard.com>
Date: Fri, 13 Jul 2001 19:40:54 -0400
Message-Id: <200107131940.AA1005912250@mail.pbwizard.com>
To: <www-dom@w3.org>
Dave,

I find the spec to be very clear.  Whatever document that the node was created from, no matter how it was created, will have it's ownerDocument property set to that document.

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.

The reason why a DocumentType node does not have an owner document (I am assuming here) is because it is also a stand-alone document.  This document is used to describe the tag structure rules for a HTML or XML document.  Thus a DocumentType node is not owned by a document.

Jeff Yates.
http://www.pbwizard.com

---------- Original Message ----------------------------------
From: David Flanagan <david@oreilly.com>
Date: Fri, 13 Jul 2001 15:30:16 -0700


The DOM Level 2 spec has this to say about Node.ownerDocument:

> The Document object associated with this node. This is also the Document
> object used to create new nodes. When this node is a Document or a
> DocumentType which is not used with any Document yet, this is null.

This specifies a couple of cases when ownerDocument is null, but it is
not clear if these are the only times that it is null.  For example,
when I create a new Element or other node with one of the
Document.createXXX() methods is the resulting node required to have its
ownerDocument property set?

      David Flanagan



--
Jeff Yates
e-mail:    PBWiz@PBWizard.com
Homepage:  http://www.PBWizard.com

--
Received on Friday, 13 July 2001 19:41:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:49 GMT