aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/parentnode/childelementcount/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ko/web/api/parentnode/childelementcount/index.html')
-rw-r--r--files/ko/web/api/parentnode/childelementcount/index.html97
1 files changed, 97 insertions, 0 deletions
diff --git a/files/ko/web/api/parentnode/childelementcount/index.html b/files/ko/web/api/parentnode/childelementcount/index.html
new file mode 100644
index 0000000000..665c417512
--- /dev/null
+++ b/files/ko/web/api/parentnode/childelementcount/index.html
@@ -0,0 +1,97 @@
+---
+title: ParentNode.childElementCount
+slug: Web/API/ParentNode/childElementCount
+tags:
+ - API
+ - DOM
+ - ParentNode
+ - Property
+ - Reference
+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")}} 인터페이스에 정의되었습니다. 이 인터페이스는 자식이 있는 {{domxref("Node")}}와 자식 {{domxref("Node")}}를 위한 두 가지 고유한 속성 집합을 포함하고 있었는데, 각각 {{domxref("ParentNode")}}와 {{domxref("ChildNode")}} 개별 인터페이스로 이동되었습니다. <code>childElementCount</code>의 경우 {{domxref("ParentNode")}}로 이동했습니다. 이것은 기술적인 변화로 호환성에는 영향을 미치지 않습니다.</p>
+</div>
+
+<h2 id="문법">문법</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 &gt; 0) {
+ // Do something
+}
+</pre>
+
+<h2 id="폴리필_IE8_IE9_Safari">폴리필 (IE8 &amp; IE9 &amp; Safari)</h2>
+
+<p>이 속성은 IE9 이전 버전에서는 지원하지 않습니다. IE9과 Safari는 <code>Document</code>와 <code>DocumentFragment</code> 객체에서 이 속성을 지원하지 않습니다.</p>
+
+<pre class="brush:js notranslate">;(function(constructor) {
+ if (constructor &amp;&amp;
+ constructor.prototype &amp;&amp;
+ 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="명세">명세</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>Split the <code>ElementTraversal</code> interface in {{domxref("ChildNode")}} and <code>ParentNode</code>. This method is now defined on the latter.<br>
+ The {{domxref("Document")}} and {{domxref("DocumentFragment")}} implemented the new interfaces.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('Element Traversal', '#attribute-childElementCount', 'ElementTraversal.childElementCount')}}</td>
+ <td>{{Spec2('Element Traversal')}}</td>
+ <td>Added its initial definition to the <code>ElementTraversal</code> pure interface and use it on {{domxref("Element")}}.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="브라우저_호환성">브라우저 호환성</h2>
+
+
+
+<p>{{Compat("api.ParentNode.childElementCount")}}</p>
+
+<h2 id="참조">참조</h2>
+
+<ul>
+ <li>{{domxref("ParentNode")}}와 {{domxref("ChildNode")}} 인터페이스.</li>
+ <li>
+ <div class="syntaxbox">이 인터페이스를 구현한 객체 타입: {{domxref("Document")}}, {{domxref("Element")}}, {{domxref("DocumentFragment")}}.</div>
+ </li>
+</ul>