翻譯不完整。請協助 翻譯此英文文件。
Node.ownerDocument
唯讀屬性會回傳一個此節點所屬的的頂層 document
物件。
語法
document = element.ownerDocument
document
is thedocument
object parent of the current element.
範例
// given a node "p", get the top-level HTML child // of the document object var d = p.ownerDocument; var html = d.documentElement;
備註
The document
object returned by this property is the main object with which all the child nodes in the actual HTML document are created. If this property is used on a node that is itself a document, the result is null
.
規範
Specification | Status | Comment |
---|---|---|
DOM4 The definition of 'Node.ownerDocument' in that specification. |
Recommendation | |
Document Object Model (DOM) Level 3 Core Specification The definition of 'Node.ownerDocument' in that specification. |
Recommendation | No change |
Document Object Model (DOM) Level 2 Core Specification The definition of 'Node.ownerDocument' in that specification. |
Recommendation | Initial definition |
瀏覽器相容性
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes)[1] | 6.0[2] | (Yes) | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | (Yes)[1] | ? | ? | ? |
[1] Starting in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6), the ownerDocument
of doctype nodes (that is, nodes for which 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] https://msdn.microsoft.com/en-us/library/ie/ms534315(v=vs.85).aspx