diff options
author | MDN <actions@users.noreply.github.com> | 2021-03-24 00:27:57 +0000 |
---|---|---|
committer | MDN <actions@users.noreply.github.com> | 2021-03-24 00:27:57 +0000 |
commit | 8d7ad7715e19a445def22de6d5f3d9519cebe69e (patch) | |
tree | dfeab89fe885baadfaa3629850e4dbf53a9a8669 /files/ja/web/api/parentnode | |
parent | 0511ab6f682be0c8401377e50cd4a164e87ec589 (diff) | |
download | translated-content-8d7ad7715e19a445def22de6d5f3d9519cebe69e.tar.gz translated-content-8d7ad7715e19a445def22de6d5f3d9519cebe69e.tar.bz2 translated-content-8d7ad7715e19a445def22de6d5f3d9519cebe69e.zip |
[CRON] sync translated content
Diffstat (limited to 'files/ja/web/api/parentnode')
-rw-r--r-- | files/ja/web/api/parentnode/childelementcount/index.html | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/files/ja/web/api/parentnode/childelementcount/index.html b/files/ja/web/api/parentnode/childelementcount/index.html deleted file mode 100644 index 6e1a4b7ea7..0000000000 --- a/files/ja/web/api/parentnode/childelementcount/index.html +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: ParentNode.childElementCount -slug: Web/API/ParentNode/childElementCount -tags: - - API - - DOM - - ParentNode - - Property -translation_of: Web/API/ParentNode/childElementCount ---- -<div>{{ APIRef("DOM") }}</div> - -<p>読み取り専用の <code><strong>ParentNode.childElementCount</strong></code> プロパティは、与えられた要素の子要素の数を表す <code>unsigned long</code> 値を返します。</p> - -<div class="note"> -<p>このプロパティは、当初 {{domxref("ElementTraversal")}} 基本インターフェースで定義されていました。このインターフェースには 2 セットの異なるプロパティが含まれており、一つは子要素を持つ {{domxref("Node")}} を対象とし、もう一つはその子要素群を対象としたものでしたが、これらは 2 つの基本インターフェースである {{domxref("ParentNode")}} と {{domxref("ChildNode")}} に移されました。この際、<code>childElementCount</code> は {{domxref("ParentNode")}} へ移されました。これは技術的な変更であり、互換性に影響を与えるものではありません。</p> -</div> - -<h2 id="Syntax" name="Syntax">構文</h2> - -<pre class="syntaxbox notranslate">var <var>count</var> = <em>node</em>.childElementCount; -</pre> - -<dl> - <dt><code>count</code></dt> - <dd><code>unsigned long</code> 型(つまり整数型)の戻り値.</dd> - <dt><code>node</code></dt> - <dd>{{domxref("Document")}}、{{domxref("DocumentFragment")}}、 {{domxref("Element")}}を表現するオブジェクト.</dd> -</dl> - -<h2 id="例">例</h2> - -<pre class="brush:js notranslate">var foo = document.getElementById('foo'); -if (foo.childElementCount > 0) { - // Do something -} -</pre> - - - -<h2 id="IE8_IE9Safari向けの互換コード">IE8, IE9/Safari向けの互換コード</h2> - -<p>このプロパティは IE9 より前のバージョンでサポートされていません。IE9とSafariでは <code>Document</code> と <code>DocumentFragment</code> においてサポートされていません。</p> - -<pre class="brush:js notranslate">;(function(constructor) { - if (constructor && - constructor.prototype && - constructor.prototype.childElementCount == null) { - Object.defineProperty(constructor.prototype, 'childElementCount', { - get: function() { - var i = 0, count = 0, node, nodes = this.childNodes; - while (node = nodes[i++]) { - if (node.nodeType === 1) count++; - } - return count; - } - }); - } -})(window.Node || window.Element);</pre> - -<h2 id="Specification" name="Specification">仕様</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">仕様書</th> - <th scope="col">状況</th> - <th scope="col">コメント</th> - </tr> - <tr> - <td>{{SpecName('DOM WHATWG', '#dom-parentnode-childElementCount', 'ParentNode.childElementCount')}}</td> - <td>{{Spec2('DOM WHATWG')}}</td> - <td><code>ElementTraversal</code> インターフェースを {{domxref("ChildNode")}} と <code>ParentNode</code> に分割。このメソッドは後者で定義されています。<br> - {{domxref("Document")}} と {{domxref("DocumentFragment")}} が新しいインターフェースを実装しました。</td> - </tr> - <tr> - <td>{{SpecName('Element Traversal', '#attribute-childElementCount', 'ElementTraversal.childElementCount')}}</td> - <td>{{Spec2('Element Traversal')}}</td> - <td>この初期定義は <code>ElementTraversal</code> 基本インターフェースに追加され、{{domxref("Element")}} で使用します。</td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザの実装状況</h2> - - - -<p>{{Compat("api.ParentNode.childElementCount")}}</p> - -<h2 id="See_also" name="See_also">関連情報</h2> - -<ul> - <li>基本インターフェースの {{domxref("ParentNode")}} と {{domxref("ChildNode")}}</li> - <li>この基本インターフェースを実装するオブジェクト型: {{domxref("Document")}}, {{domxref("Element")}}, {{domxref("DocumentFragment")}}</li> -</ul> |