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/ru/web/api/element/childelementcount/index.html | |
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/ru/web/api/element/childelementcount/index.html')
-rw-r--r-- | files/ru/web/api/element/childelementcount/index.html | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/files/ru/web/api/element/childelementcount/index.html b/files/ru/web/api/element/childelementcount/index.html new file mode 100644 index 0000000000..4e5469b731 --- /dev/null +++ b/files/ru/web/api/element/childelementcount/index.html @@ -0,0 +1,123 @@ +--- +title: Node.childElementCount +slug: Web/API/Element/childElementCount +tags: + - API + - DOM + - ParentNode + - Property + - Reference +translation_of: Web/API/ParentNode/childElementCount +original_slug: Web/API/ParentNode/childElementCount +--- +<div> +<p>{{ APIRef("DOM") }}</p> + +<p>Свойство<code><strong> Node.childElementCount</strong></code> предназначено только для чтения и возвращает число дочерних<u> элементов</u> узла.</p> +</div> + +<h2 id="Syntax" name="Syntax">Синтаксис</h2> + +<pre class="syntaxbox">var <var>elCount</var> = Node.childElementCount; +</pre> + +<ul> + <li><code><strong>elCount</strong></code> - целое число, количество дочерних элементов узла <strong>Node.</strong></li> + <li><code><strong>Node</strong></code> - объект, представляющий собой <code>Document</code>, <code>DocumentFragment</code> или <code>Element</code>.</li> +</ul> + +<div class="warning"> +<p>А наш добрый друг<strong> Internet Explorer </strong>в <strong>6, 7</strong> и <strong>8</strong> версиях ошибочно считает элементами комментарии в HTML-коде ({{domxref("Comment")}}).</p> +</div> + +<h2 id="Пример">Пример</h2> + +<pre class="brush:js line-numbers language-js"><code class="language-js"><span class="keyword token">var</span> foo <span class="operator token">=</span> document<span class="punctuation token">.</span><span class="function token">getElementById</span><span class="punctuation token">(</span><span class="string token">"foo"</span><span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="keyword token">if</span> <span class="punctuation token">(</span>foo<span class="punctuation token">.</span>childElementCount <span class="operator token">></span> <span class="number token">0</span><span class="punctuation token">)</span> <span class="punctuation token">{</span> + <span class="comment token">// здесь нужный код..</span> +<span class="punctuation token">}</span></code></pre> + +<h2 id="Спецификация">Спецификация</h2> + +<table class="standard-table"> + <tbody> + <tr> + <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> + </tr> + <tr> + <td>{{SpecName('Element Traversal', '#attribute-childElementCount', 'ElementTraversal.childElementCount')}}</td> + <td>{{Spec2('Element Traversal')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Поддержка_браузерами">Поддержка браузерами</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Особенность</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Базовая поддержка {{domxref("Element")}}</td> + <td>1.0</td> + <td>{{CompatGeckoDesktop("1.9.1")}}</td> + <td>9.0 [1]</td> + <td>10.0</td> + <td>4.0</td> + </tr> + <tr> + <td>Поддержка {{domxref("Document")}} и {{domxref("DocumentFragment")}} {{experimental_inline}}</td> + <td>29.0</td> + <td>{{CompatGeckoDesktop("25.0")}}</td> + <td>{{CompatNo}}</td> + <td>16.0</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Особенность</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Базовая поддержка {{domxref("Element")}}</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{CompatGeckoMobile("1.9.1")}}</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</td> + </tr> + <tr> + <td>Поддержка {{domxref("Document")}} и {{domxref("DocumentFragment")}} {{experimental_inline}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("25.0")}}</td> + <td>{{CompatNo}}</td> + <td>16.0</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> |