[15] [CODE(HTMLe)@en[iframe]] [[要素]]の 
[DFN[[CODE(DOMa)@en[contentDocument]]]]
[[IDL属性]]は、[[フレーム]]内の[[文書]] ([CODE(DOMi)@en[Document]])
を返します。

* 仕様書

[REFS[
- [7] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-03-31 07:16:44 +09:00]] 版) <https://html.spec.whatwg.org/#dom-iframe-contentdocument>
- [13] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-03-31 07:16:44 +09:00]] 版) <https://html.spec.whatwg.org/#dom-object-contentdocument>
- [14] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-03-31 07:16:44 +09:00]] 版) <https://html.spec.whatwg.org/#dom-frame-contentdocument>
- [24] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-05-20 22:03:07 +09:00]]) <https://html.spec.whatwg.org/#concept-bcc-content-document>
]REFS]

* 取得器

[8] [CODE(DOMi)@en[HTMLIFrameElement]] [[インターフェイス]]や
[CODE(DOMi)@en[HTMLObjectElement]] [[インターフェイス]]や
[CODE(DOMi)@en[HTMLFrameElement]] [[インターフェイス]]の
[DFN[[CODE(DOMa)@en[contentDocument]]]] [[IDL属性]]の[[取得器]]は、
次のようにしなければ[MUST[なりません]] [SRC[>>7, >>13, >>14]]。
[FIG(steps)[
= [22] [[文脈オブジェクト]]の[F[内容文書]]を返します。
]FIG]

[23] [[閲覧文脈包含子]][VAR[要素]]の[DFN[[F[[RUBYB[[[内容文書]]]@en[content document]]]]]]は、
次のものです [SRC[>>24]]。
[FIG(steps)[
= [9] 
[FIG(list)[
- [19] [VAR[要素]]の[F[入れ子閲覧文脈]]が [[null]]
- [10] [VAR[要素]]の[F[入れ子閲覧文脈]]の[F[活性文書]]の[F[起源][文書の起源]]が[[現在設定群オブジェクト]]の[F[起源]]と[[同じ起源ドメイン]]でない
]FIG]
... のいずれかの場合、
== [12] [[null]] を返します。
= [20] それ以外なら、
== [11] [VAR[要素]]の[F[入れ子閲覧文脈]]の[F[活性文書]]を返します。
]FIG]

[16] [[文書中]]にない場合や、[[プラグイン]]等を表す [CODE(HTMLe)@en[object]]
[[要素]]は、 [CODE(DOMa)@en[contentDocument]] が [[null]] になります。

[17] [[フレーム]]の内外で[[起源]]が異なる時も、 
[CODE(DOMa)@en[contentDocument]] が [[null]] になります。

* 関連

[18] [CODE(DOMa)@en[contentWindow]]、 [CODE(DOMm)@en[getSVGDocument]] も参照。

* 歴史

[1] [CITE@en[Compound Document by Reference Framework 1.0]]
( ([TIME[2010-08-17 16:50:04 +09:00]] 版))
<http://www.w3.org/TR/CDR/#parent-to-child-dom-access>

[2] [CITE@en-US-x-hixie[HTML Standard]]
( ([TIME[2012-12-05 05:38:42 +09:00]] 版))
<http://www.whatwg.org/specs/web-apps/current-work/#dom-iframe-contentdocument>

[3] [CITE@en[Web Applications 1.0 r8272     Change iframe, frame, and object.contentDocument to return null when cross-origin documents are involved.]]
( ([TIME[2013-11-13 06:50:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=8271&to=8272>

[4] [CITE@en[829872 – Consider returning null from contentDocument getters when the caller does not subsume the document]]
( ([TIME[2013-11-13 20:41:52 +09:00]] 版))
<https://bugzilla.mozilla.org/show_bug.cgi?id=829872>

[5] [CITE@en[422025 – iframe.contentDocument should use XOW (was: iframe.contentDocument should be restricted like window.document)]]
( ([TIME[2013-11-13 21:21:39 +09:00]] 版))
<https://bugzilla.mozilla.org/show_bug.cgi?id=422025>

[6] [CITE@en[Merge effective script origin into origin · whatwg/html@8a843f2]]
([TIME[2016-03-31 16:39:04 +09:00]] 版)
<https://github.com/whatwg/html/commit/8a843f2169a6864a3024c4329528dccb2051d275>

[21] [CITE@en[Define contentDocument using a more clearly defined shared concept]]
( ([[Ms2ger]]著, [TIME[2016-05-04 21:03:56 +09:00]]))
<https://github.com/whatwg/html/commit/ea2f021c265bd082415f2775fc7a1c562ec7275a>

[25] [CITE@en[Use current settings object in content document definition]]
([[domenic]]著, [TIME[2016-07-13 08:08:54 +09:00]])
<https://github.com/whatwg/html/commit/a6a1b714d2b3288fbf88528ac9182f9263b92bc8>