diff options
author | MDN <actions@users.noreply.github.com> | 2021-04-17 00:11:36 +0000 |
---|---|---|
committer | MDN <actions@users.noreply.github.com> | 2021-04-17 00:11:36 +0000 |
commit | 0ccebc7eb352eda4d26d0b876fea36f24f482eec (patch) | |
tree | f5c0a32bc5149d8bd5aa7942577758ce7c8ed485 /files/ko/web/api | |
parent | 40cd01daeb2f6f7fff40ff2986208513afc8678e (diff) | |
download | translated-content-0ccebc7eb352eda4d26d0b876fea36f24f482eec.tar.gz translated-content-0ccebc7eb352eda4d26d0b876fea36f24f482eec.tar.bz2 translated-content-0ccebc7eb352eda4d26d0b876fea36f24f482eec.zip |
[CRON] sync translated content
Diffstat (limited to 'files/ko/web/api')
-rw-r--r-- | files/ko/web/api/parentnode/append/index.html | 134 | ||||
-rw-r--r-- | files/ko/web/api/parentnode/prepend/index.html | 133 |
2 files changed, 0 insertions, 267 deletions
diff --git a/files/ko/web/api/parentnode/append/index.html b/files/ko/web/api/parentnode/append/index.html deleted file mode 100644 index 1c9496b65b..0000000000 --- a/files/ko/web/api/parentnode/append/index.html +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: ParentNode.append() -slug: Web/API/ParentNode/append -translation_of: Web/API/ParentNode/append ---- -<div>{{APIRef("DOM")}}</div> - -<p><strong><code>ParentNode.append()</code></strong> 메서드는 <code>ParentNode</code>의 마지막 자식 뒤에 {{domxref("Node")}} 객체 또는 {{domxref("DOMString")}} 객체를 삽입한다. {{domxref("DOMString")}} 객체는 {{domxref("Text")}} 노드처럼 삽입한다.</p> - -<p>{{domxref("Node.appendChild()")}}와 다른 점:</p> - -<ul> - <li><code>ParentNode.append()</code>는 {{domxref("DOMString")}} 객체도 추가할 수 있다. 한편 <code>Node.appendChild()</code>는 오직 {{domxref("Node")}} 객체만 허용한다.</li> - <li><code>ParentNode.append()</code>는 반환하는 값이 없다. 한편 <code>Node.appendChild()</code>는 추가한 {{domxref("Node")}} 객체를 반환한다.</li> - <li><code>ParentNode.append()</code>는 여러 개 노드와 문자를 추가할 수 있다. 한편 <code>Node.appendChild()</code>는 오직 노드 하나만 추가할 수 있다.</li> -</ul> - -<h2 id="문법">문법</h2> - -<pre class="syntaxbox">[Throws, Unscopable] -void ParentNode.append((Node or DOMString)... nodes); -</pre> - -<h3 id="매개_변수">매개 변수</h3> - -<dl> - <dt><code>nodes</code></dt> - <dd>삽입하려고 하는 {{domxref("Node")}} 객체 집합 또는 {{domxref("DOMString")}} 객체 집합.</dd> -</dl> - -<h3 id="예외">예외</h3> - -<ul> - <li>{{domxref("HierarchyRequestError")}}: 계층 구조의 지정된 지점에 노드를 삽입 할 수 없다.</li> -</ul> - -<h2 id="예제">예제</h2> - -<h3 id="요소element_추가하기">요소(element) 추가하기</h3> - -<pre class="brush: js">var parent = document.createElement("div"); -var p = document.createElement("p"); -parent.append(p); - -console.log(parent.childNodes); // NodeList [ <p> ] -</pre> - -<h3 id="문자text_추가하기">문자(text) 추가하기</h3> - -<pre class="brush: js">var parent = document.createElement("div"); -parent.append("Some text"); - -console.log(parent.textContent); // "Some text"</pre> - -<h3 id="요소element와_문자text_함께_추가하기">요소(element)와 문자(text) 함께 추가하기</h3> - -<pre class="brush: js">var parent = document.createElement("div"); -var p = document.createElement("p"); -parent.append("Some text", p); - -console.log(parent.childNodes); // NodeList [ #text "Some text", <p> ]</pre> - -<h3 id="ParentNode.append_범위_지정_불가"><code>ParentNode.append()</code> 범위 지정 불가</h3> - -<p><code>append()</code> 메소드는 <code>with</code> 문으로 범위를 지정하지 않는다. 더 자세한 내용은 {{jsxref("Symbol.unscopables")}} 참고.</p> - -<pre class="brush: js">var parent = document.createElement("div"); - -with(parent) { - append("foo"); -} -// ReferenceError: append is not defined </pre> - -<h2 id="대체_구현">대체 구현</h2> - -<p>다음 코드를 이용하면 인터넷 익스플로러 9 이상에서 <code>append() method</code>를 대체하여 구현할 수 있다.</p> - -<pre class="brush: js">// Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/append()/append().md -(function (arr) { - arr.forEach(function (item) { - if (item.hasOwnProperty('append')) { - return; - } - Object.defineProperty(item, 'append', { - configurable: true, - enumerable: true, - writable: true, - value: function append() { - var argArr = Array.prototype.slice.call(arguments), - docFrag = document.createDocumentFragment(); - - argArr.forEach(function (argItem) { - var isNode = argItem instanceof Node; - docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem))); - }); - - this.appendChild(docFrag); - } - }); - }); -})([Element.prototype, Document.prototype, DocumentFragment.prototype]);</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-append', 'ParentNode.append()')}}</td> - <td>{{Spec2('DOM WHATWG')}}</td> - <td>초기 정의</td> - </tr> - </tbody> -</table> - -<h2 id="브라우저_호환성">브라우저 호환성</h2> - - - -<p>{{Compat("api.ParentNode.append")}}</p> - -<h2 id="참고">참고</h2> - -<ul> - <li>{{domxref("ParentNode")}} and {{domxref("ChildNode")}}</li> - <li>{{domxref("ParentNode.prepend()")}}</li> - <li>{{domxref("Node.appendChild()")}}</li> - <li>{{domxref("ChildNode.after()")}}</li> - <li>{{domxref("NodeList")}}</li> -</ul> diff --git a/files/ko/web/api/parentnode/prepend/index.html b/files/ko/web/api/parentnode/prepend/index.html deleted file mode 100644 index 1877529adc..0000000000 --- a/files/ko/web/api/parentnode/prepend/index.html +++ /dev/null @@ -1,133 +0,0 @@ ---- -title: ParentNode.prepend() -slug: Web/API/ParentNode/prepend -translation_of: Web/API/ParentNode/prepend ---- -<div>{{APIRef("DOM")}}</div> - -<p><strong><code>ParentNode.prepend()</code></strong> 메소드는 {{domxref("Node")}} 객체 또는{{domxref("DOMString")}} 객체를 {{domxref("ParentNode")}}의 첫 자식노드 앞에 삽입한다. {{domxref("DOMString")}} 객체는 {{domxref("Text")}} 노드와 동일하게 삽입된다.</p> - -<h2 id="Syntax">Syntax</h2> - -<pre class="syntaxbox"><em>ParentNode</em>.prepend(<em>...nodesToPrepend</em>); -</pre> - -<h3 id="Parameters">Parameters</h3> - -<dl> - <dt><code>nodesToPrepend</code></dt> - <dd>One or more nodes to insert before the first child node currently in the <code>ParentNode</code>. Each node can be specified as either a {{domxref("Node")}} object or as a string; strings are inserted as new {{domxref("Text")}} nodes.</dd> -</dl> - -<h3 id="Return_value">Return value</h3> - -<p><code>undefined</code>.</p> - -<h3 id="Exceptions">Exceptions</h3> - -<ul> - <li>{{domxref("HierarchyRequestError")}}: Node cannot be inserted at the specified point in the hierarchy.</li> -</ul> - -<h2 id="Examples">Examples</h2> - -<h3 id="Prepending_an_element">Prepending an element</h3> - -<pre class="brush: js">var parent = document.createElement("div"); -var p = document.createElement("p"); -var span = document.createElement("span"); -parent.append(p); -parent.prepend(span); - -console.log(parent.childNodes); // NodeList [ <span>, <p> ] -</pre> - -<h3 id="Prepending_text">Prepending text</h3> - -<pre class="brush: js">var parent = document.createElement("div"); -parent.append("Some text"); -parent.prepend("Headline: "); - -console.log(parent.textContent); // "Headline: Some text"</pre> - -<h3 id="Appending_an_element_and_text">Appending an element and text</h3> - -<pre class="brush: js">var parent = document.createElement("div"); -var p = document.createElement("p"); -parent.prepend("Some text", p); - -console.log(parent.childNodes); // NodeList [ #text "Some text", <p> ]</pre> - -<h3 id="ParentNode.prepend()_is_unscopable"><code>ParentNode.prepend()</code> is unscopable</h3> - -<p>The <code>prepend()</code> method is not scoped into the <code>with</code> statement. See {{jsxref("Symbol.unscopables")}} for more information.</p> - -<pre class="brush: js">var parent = document.createElement("div"); - -with(parent) { - prepend("foo"); -} -// ReferenceError: prepend is not defined </pre> - -<h2 id="Polyfill">Polyfill</h2> - -<p>You can polyfill the <code>prepend()</code> method if it's not available:</p> - -<pre class="brush: js">// Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/prepend()/prepend().md -(function (arr) { - arr.forEach(function (item) { - if (item.hasOwnProperty('prepend')) { - return; - } - Object.defineProperty(item, 'prepend', { - configurable: true, - enumerable: true, - writable: true, - value: function prepend() { - var argArr = Array.prototype.slice.call(arguments), - docFrag = document.createDocumentFragment(); - - argArr.forEach(function (argItem) { - var isNode = argItem instanceof Node; - docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem))); - }); - - this.insertBefore(docFrag, this.firstChild); - } - }); - }); -})([Element.prototype, Document.prototype, DocumentFragment.prototype]);</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-prepend', 'ParentNode.prepend()')}}</td> - <td>{{Spec2('DOM WHATWG')}}</td> - <td>Initial definition.</td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - - - -<p>{{Compat("api.ParentNode.prepend")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li>{{domxref("ParentNode")}} and {{domxref("ChildNode")}}</li> - <li>{{domxref("ParentNode.append()")}}</li> - <li>{{domxref("Node.appendChild()")}}</li> - <li>{{domxref("Node.insertBefore()")}}</li> - <li>{{domxref("ChildNode.before()")}}</li> - <li>{{domxref("NodeList")}}</li> -</ul> |