From d192fb918b0e2aa8869de6dcc59de8464b6e879a Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 11 Dec 2020 18:59:39 -0500 Subject: dump 2020-12-11 --- files/ja/web/api/document/body/index.html | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'files/ja/web/api/document') diff --git a/files/ja/web/api/document/body/index.html b/files/ja/web/api/document/body/index.html index 055e65e7a1..cf20308c6b 100644 --- a/files/ja/web/api/document/body/index.html +++ b/files/ja/web/api/document/body/index.html @@ -3,7 +3,6 @@ title: Document.body slug: Web/API/Document/body tags: - API - - BODY - Document - HTML DOM - Property @@ -17,26 +16,26 @@ translation_of: Web/API/Document/body

構文

-
var objRef = document.body;
-document.body = objRef;
+
const objRef = document.body
+document.body = objRef

-
// Given this HTML: <body id="oldBodyElement"></body>
+
// Given this HTML: <body id="oldBodyElement"></body>
 alert(document.body.id); // "oldBodyElement"
 
-var aNewBodyElement = document.createElement("body");
+const aNewBodyElement = document.createElement("body");
 
 aNewBodyElement.id = "newBodyElement";
 document.body = aNewBodyElement;
 alert(document.body.id); // "newBodyElement"
 
-

メモ

+

document.body は文書の内容を持つ要素です。 <body> の内容を持つ文書では <body> 要素を返し、フレームセット文書では、これは最も外側の <frameset> 要素を返します。

-

body は設定が可能ですが、文書に新しい body を設定すると、既存の <body> 要素の子ノードは全て削除されます。

+

body プロパティは設定が可能ですが、文書に新しい body を設定すると、既存の <body> 要素の子ノードは全て削除されます。

仕様書

@@ -52,32 +51,22 @@ alert(document.body.id); // "newBodyElement" {{SpecName('HTML WHATWG','dom.html#dom-document-body','Document.body')}} {{Spec2('HTML WHATWG')}} -   + {{SpecName('HTML5.1','dom.html#dom-document-body','Document.body')}} {{Spec2('HTML5.1')}} -   + {{SpecName('HTML5 W3C','dom.html#dom-document-body','Document.body')}} {{Spec2('HTML5 W3C')}} -   - - - {{SpecName('DOM2 HTML','html.html#ID-56360201','Document.body')}} - {{Spec2('DOM2 HTML')}} -   - - - {{SpecName('DOM1','level-one-html.html#attribute-body','Document.body')}} - {{Spec2('DOM1')}} - 初回定義 + -

ブラウザーの対応

+

ブラウザーの互換性

-- cgit v1.2.3-54-g00ecf