--- title: Node.ownerDocument slug: Web/API/Node/ownerDocument tags: - API - DOM - Nodo - Propiedad - Referencia translation_of: Web/API/Node/ownerDocument ---
La propiedad de lectura ownerDocument
de la interfaz {{domxref("Node")}} devuelve el objeto Document de más alto nivel/jerarquia para ese nodo.
var document = element.ownerDocument;
document
es el objeto {{domxref("Document")}} de más alto nivel, con el que todos los nodos descendientes se crean. Si la propiedad se usa en un nodo que el mismo es un Document, el resultado es null
.
// dado un nodo "p", coge el hijo que tenga la más alta jerarquia // del objeto Document var d = p.ownerDocument; var html = d.documentElement;
Especificación | Estado | Comentario |
---|---|---|
{{SpecName("DOM4", "#dom-node-ownerdocument", "Node.ownerDocument")}} | {{Spec2("DOM4")}} | |
{{SpecName("DOM3 Core", "core.html#node-ownerDoc", "Node.ownerDocument")}} | {{Spec2("DOM3 Core")}} | No change |
{{SpecName("DOM2 Core", "core.html#node-ownerDoc", "Node.ownerDocument")}} | {{Spec2("DOM2 Core")}} | Initial definition |
{{CompatibilityTable}}
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Soporte básico | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}}[1] | 6.0[2] | {{CompatVersionUnknown}} | {{CompatUnknown}} |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Soporte básico | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}}[1] | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
[1] Starting in Gecko 9.0 {{geckoRelease("9.0")}}, the ownerDocument
of doctype nodes (that is, nodes for which {{domxref("Node.nodeType")}} is Node.DOCUMENT_TYPE_NODE
or 10) is no longer null
. Instead, the ownerDocument
is the document on which document.implementation.createDocumentType()
was called.
[2] http://msdn.microsoft.com/en-us/library/ie/ms534315(v=vs.85).aspx