文書body要素

Document インターフェイス body 属性 (DOM)

[18] Document インターフェイスbody IDL属性は、文書body要素を返します。 ほとんどの場合、 document.body 属性body 要素を返すものです。

仕様書

意味

[4] 文書body要素 (the body element) は、 文書html要素の最初の body 要素または frameset 要素である子供です。 そのような要素がなければ、 null です。 >>3

[27] こちらの定義は、 HTMLDOM で使われています。

[25] HTML body要素 (the HTML body element) は、 根要素である html 要素の最初の body 要素子供です。 >>24

[26] こちらの定義は、 CSS で使われています。 frameset 要素は該当しません。

取得器

[5] Document インターフェイスbody IDL属性取得器は、 文書body要素を返さなければなりません >>3

設定器

[6] Document インターフェイスbody IDL属性設定器は、 次のようにしなければなりません >>3

  1. [7] 新しい値を HTMLElement? として解釈します。
  2. [8] 新しい値が body 要素でも frameset 要素でもなければ、
    1. [9] HierarchyRequestError 例外投げ、ここで停止します。
  3. [10] 新しい値が文書body要素なら、
    1. [13] ここで停止します。
  4. [11] 文書body要素null 以外なら、
    1. [12] 新しい値で文書body要素置換します。ここで停止します。
  5. [14] 文書body要素null なら、
    1. [15] 根要素があれば、
      1. [16] 新しい値を根要素append します。

[17] 根要素文書html要素とは限りませんが、 append しなければならないことになっています。

歴史

[1] Web Applications 1.0 r7800 Match reality ( ( 版)) <http://html5.org/tools/web-apps-tracker?from=7799&to=7800>

[2] IRC logs: freenode / #whatwg / 20130417 ( ( 版)) <http://krijnhoetmer.nl/irc-logs/whatwg/20130417#l-1157>

メモ

[19] 構文解析器body 要素文書に挿入する前に実行されるスクリプトでは、 document.bodynull になります。

[20] 今日では frameset 要素はほとんど用いられることが無いため、 スクリプトは普通は body 要素が返されるものと考えて構いません。

[21] Editorial: synchronize with the DOM Standard · whatwg/html@21c6ec7 ( 版) <https://github.com/whatwg/html/commit/21c6ec77594eb89b836d4872222f5916910967fd>

[22] Formalize custom element reactions · whatwg/html@27aa7bc ( 版) <https://github.com/whatwg/html/commit/27aa7bc4fa6f168654a8c858f0773e611f679b39>

[23] Specify how html and body elements fill the viewport ( (zcorpan著, )) <https://github.com/whatwg/quirks/commit/c81e2a263fb9f89fdfc55010afe666f1711540b7>

[28] Call out inconsistency in document.body behavior (zcorpan著, ) <https://github.com/whatwg/html/commit/aa2bec4ee4089f7e6329d3e285b6b5782ab3efc2>

[29] How should document.body setter behave when root is not an `<html>`? · Issue #3403 · whatwg/html () <https://github.com/whatwg/html/issues/3403>

[30] Call out inconsistency in document.body behavior by zcorpan · Pull Request #3449 · whatwg/html () <https://github.com/whatwg/html/pull/3449>