From 5192b3e5cfef0c1afca0ce844f9ab6b4d14259e9 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Fri, 27 Aug 2021 20:33:27 +0900 Subject: 旧 ParentNode の childElementCount プロパティの文書を整備 (#2094) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 2021/08/15 時点の英語版に同期 --- .../web/api/document/childelementcount/index.html | 46 +++++++++++++++++++++ .../documentfragment/childelementcount/index.html | 48 ++++++++++++++++++++++ .../web/api/element/childelementcount/index.html | 4 +- 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 files/ja/web/api/document/childelementcount/index.html create mode 100644 files/ja/web/api/documentfragment/childelementcount/index.html (limited to 'files/ja/web') diff --git a/files/ja/web/api/document/childelementcount/index.html b/files/ja/web/api/document/childelementcount/index.html new file mode 100644 index 0000000000..fcd6244dd0 --- /dev/null +++ b/files/ja/web/api/document/childelementcount/index.html @@ -0,0 +1,46 @@ +--- +title: Document.childElementCount +slug: Web/API/Document/childElementCount +tags: + - API + - DOM + - Property + - Reference +browser-compat: api.Document.childElementCount +translation_of: Web/API/Document/childElementCount +--- +
{{ APIRef("DOM") }}
+ +

Document.childElementCount は読み取り専用のプロパティで、文書の子要素の数を返します。

+ +

特定の要素の子要素の数を取得する場合は、 {{domxref("Element.childElementCount")}} を参照してください。

+ +

構文

+ +
document.childElementCount;
+
+ +

+ +
+document.children;
+// HTMLCollection で、ふつうは <html> 要素をこの文書の唯一の子として含んでいる
+
+document.childElementCount;
+// 1
+
+ +

仕様書

+ +{{Specifications}} + +

ブラウザーの互換性

+ +

{{Compat}}

+ +

関連情報

+ + diff --git a/files/ja/web/api/documentfragment/childelementcount/index.html b/files/ja/web/api/documentfragment/childelementcount/index.html new file mode 100644 index 0000000000..16bc5ed135 --- /dev/null +++ b/files/ja/web/api/documentfragment/childelementcount/index.html @@ -0,0 +1,48 @@ +--- +title: DocumentFragment.childElementCount +slug: Web/API/DocumentFragment/childElementCount +tags: + - API + - DOM + - Property + - Reference +browser-compat: api.DocumentFragment.childElementCount +translation_of: Web/API/DocumentFragment/childElementCount +--- +
{{ APIRef("DOM") }}
+ +

Document.childElementCount は読み取り専用のプロパティで、 DocumentFragment の子要素の数を返します。

+ +

特定の要素の子要素の数を取得する場合は、 {{domxref("Element.childElementCount")}} を参照してください。

+ +

構文

+ +
fragment.childElementCount;
+
+ +

+ +
+let fragment = new DocumentFragment()
+fragment.childElementCount; // 0
+
+let paragraph = document.createElement('p')
+fragment.appendChild(paragraph)
+
+fragment.childElementCount; // 1
+
+ +

仕様書

+ +{{Specifications}} + +

ブラウザーの互換性

+ +

{{Compat}}

+ +

関連情報

+ + diff --git a/files/ja/web/api/element/childelementcount/index.html b/files/ja/web/api/element/childelementcount/index.html index 57d59747ce..c3520c9a31 100644 --- a/files/ja/web/api/element/childelementcount/index.html +++ b/files/ja/web/api/element/childelementcount/index.html @@ -22,11 +22,11 @@ original_slug: Web/API/ParentNode/childElementCount
let sidebar = document.getElementById('sidebar');
 if (sidebar.childElementCount > 0) {
-  // Do something
+  // 何もしない
 }
 
-

仕様書

+

仕様書

{{Specifications}} -- cgit v1.2.3-54-g00ecf