ownerDocument (W3C DOM Core property)
| Version | Depr. | Static | Read-only |
|---|---|---|---|
| DOM2 | No | No | Yes |
| IE6+ | FF1.5+ | SA1.3+ | OP9+ |
|---|---|---|---|
| Full | Full | Full | Full |
Example
var owner = node.ownerDocument;
In
the example above, if node is an Element then the owner variable will
be a reference to the document that contains it.
The owner document
reference can then be used to call methods of Document, as in the following example:
var owner = node.ownerDocument;
var em = owner.createElement('em');
em.appendChild(owner.createTextNode('Exterminate!'));
node.appendChild(em);
Description
The Document which contains this node; or
null if this node is itself a Document, or a DocumentType that
is not associated with any document.
This property is read-only.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 1.5 | 2.0 | 3.0 | 1.3 | 2.0 | 3.0 | 9.0 | 9.5 |
| Partial | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full |
Internet Explorer 5.5 in HTML does not implement this property, and will return undefined.
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.