diff options
author | MDN <actions@users.noreply.github.com> | 2021-04-14 00:11:31 +0000 |
---|---|---|
committer | MDN <actions@users.noreply.github.com> | 2021-04-14 00:11:31 +0000 |
commit | db26cf86829f9b43d29f18b9bbf197e9e2d55c31 (patch) | |
tree | 9e4b1a32107c07b5a6d3d449f9d52f3d645aa87f /files/ko/orphaned | |
parent | 2a80998020496995b1eb33e0a2ed024f1708535d (diff) | |
download | translated-content-db26cf86829f9b43d29f18b9bbf197e9e2d55c31.tar.gz translated-content-db26cf86829f9b43d29f18b9bbf197e9e2d55c31.tar.bz2 translated-content-db26cf86829f9b43d29f18b9bbf197e9e2d55c31.zip |
[CRON] sync translated content
Diffstat (limited to 'files/ko/orphaned')
-rw-r--r-- | files/ko/orphaned/web/api/parentnode/children/index.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/files/ko/orphaned/web/api/parentnode/children/index.html b/files/ko/orphaned/web/api/parentnode/children/index.html new file mode 100644 index 0000000000..71dd79c408 --- /dev/null +++ b/files/ko/orphaned/web/api/parentnode/children/index.html @@ -0,0 +1,86 @@ +--- +title: ParentNode.children +slug: orphaned/Web/API/ParentNode/children +translation_of: Web/API/ParentNode/children +original_slug: Web/API/ParentNode/children +--- +<div>{{ APIRef("DOM") }}</div> + +<p><span class="seoSummary">{{domxref("ParentNode")}}의 속성 <code><strong>children</strong></code>은 호출된 요소의 모든 자식 노드의 {{domxref("Element","elements")}}를 담고있는 실시간 {{domxref("HTMLCollection")}}을 반환합니다.</span></p> + +<h2 id="Syntax">Syntax </h2> + +<pre class="syntaxbox">var <em>children</em> = <em>node</em>.children;</pre> + +<h3 id="Value">Value</h3> + +<p>실시간이며, <code>node</code>의 자식 DOM 요소들의 정렬된 컬렉션인 {{ domxref("HTMLCollection") }}. 각 자식 요소를 컬렉션 안에서 접근하기 위해서 {{domxref("HTMLCollection.item", "item()")}} 메소드를 이용하거나 Javascript 배열 스타일의 문법을 사용할 수 있습니다.</p> + +<p>만약 노드가 자식요소를 갖고 있지 않나면, <code>children</code>은 0의 <code>length</code>를 가진 빈 리스트 일 것입니다.</p> + +<h2 id="Example">Example</h2> + +<pre class="brush: js">var foo = document.getElementById('foo'); +for (var i = 0; i < foo.children.length; i++) { + console.log(foo.children[i].tagName); +} +</pre> + +<h2 id="Polyfill">Polyfill</h2> + +<pre class="brush: js">// Overwrites native 'children' prototype. +// Adds Document & DocumentFragment support for IE9 & Safari. +// Returns array instead of HTMLCollection. +;(function(constructor) { + if (constructor && + constructor.prototype && + constructor.prototype.children == null) { + Object.defineProperty(constructor.prototype, 'children', { + get: function() { + var i = 0, node, nodes = this.childNodes, children = []; + while (node = nodes[i++]) { + if (node.nodeType === 1) { + children.push(node); + } + } + return children; + } + }); + } +})(window.Node || window.Element); +</pre> + +<h2 id="Specification">Specification</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('DOM WHATWG', '#dom-parentnode-children', 'ParentNode.children')}}</td> + <td>{{Spec2('DOM WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.ParentNode.children")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The {{domxref("ParentNode")}} and {{domxref("ChildNode")}} interfaces.</li> + <li> + <div class="syntaxbox">Object types implementing this interface: {{domxref("Document")}}, {{domxref("Element")}}, and {{domxref("DocumentFragment")}}.</div> + </li> + <li> + <div class="syntaxbox">{{domxref("Node.childNodes")}}</div> + </li> +</ul> |