diff options
Diffstat (limited to 'files/ko/web/api/document/createdocumentfragment/index.html')
-rw-r--r-- | files/ko/web/api/document/createdocumentfragment/index.html | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/files/ko/web/api/document/createdocumentfragment/index.html b/files/ko/web/api/document/createdocumentfragment/index.html new file mode 100644 index 0000000000..7c4fb33469 --- /dev/null +++ b/files/ko/web/api/document/createdocumentfragment/index.html @@ -0,0 +1,134 @@ +--- +title: Document.createDocumentFragment() +slug: Web/API/Document/createDocumentFragment +translation_of: Web/API/Document/createDocumentFragment +--- +<div>{{ApiRef("DOM")}}</div> + +<p>새로운 빈 {{domxref("DocumentFragment")}} 를 생성합니다.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox">var <var>docFragment</var> = document.createDocumentFragment(); +</pre> + +<p><code>docFragment</code> 는 빈 {{domxref("DocumentFragment")}} 객체를 나타냅니다.</p> + +<h2 id="Description">Description</h2> + +<p><code>DocumentFragment</code>s 는 DOM 노드들 입니다. 이것들은 메인 DOM 트리의 일부가 되지 않습니다. 일반적인 유즈 케이스는 다큐먼트 조각을 생성하고, 엘리먼트들을 다큐먼트 조각에 추가하고 그 다큐먼트 조각을 DOM 트리에 추가하는 것입니다. DOM 트리 내에서 다큐먼트 조각은 그것의 모든 자식들로 대체됩니다.</p> + +<p>메모리 내에 다큐먼트 조각이 존재하고 메인 DOM 트리의 일부가 아니라면, 이것에 자식들을 추가하는 것은 페이지 <a href="https://developers.google.com/speed/articles/reflow?csw=1">reflow</a> (엘리먼트의 위치와 좌표의 계산) 를 유발하지 않습니다. 따라서, 다큐먼트 조각을 사용하는 것은 보통 <a href="http://ejohn.org/blog/dom-documentfragments/">better performance</a> 의 결과를 가져옵니다.</p> + +<h2 id="Example">Example</h2> + +<pre class="brush: js">var ul = document.getElementsByTagName("ul")[0]; // assuming it exists +var docfrag = document.createDocumentFragment(); +var browserList = ["Internet Explorer", "Firefox", "Safari", + "Chrome", "Opera"]; + +browserList.forEach(function(e) { + var li = document.createElement("li"); + li.textContent = e; + docfrag.appendChild(li); +}); + +ul.appendChild(docfrag); +// a list with well-known web browsers +</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('DOM WHATWG', '#dom-document-createdocumentfragment', 'Document.createDocumentFragment()')}}</td> + <td>{{Spec2('DOM WHATWG')}}</td> + <td>No change</td> + </tr> + <tr> + <td>{{SpecName('DOM4', '#dom-document-createdocumentfragment', 'Document.createDocumentFragment()')}}</td> + <td>{{Spec2('DOM4')}}</td> + <td>Clarifies that the node document of the created document fragment is the context object.</td> + </tr> + <tr> + <td>{{SpecName('DOM3 Core', 'core.html#ID-35CB04B5', 'Document.createDocumentFragment()')}}</td> + <td>{{Spec2('DOM3 Core')}}</td> + <td>No change</td> + </tr> + <tr> + <td>{{SpecName('DOM2 Core', 'core.html#ID-35CB04B5', 'Document.createDocumentFragment()')}}</td> + <td>{{Spec2('DOM2 Core')}}</td> + <td>No change</td> + </tr> + <tr> + <td>{{SpecName('DOM1', 'level-one-core.html#ID-35CB04B5', 'Document.createDocumentFragment()')}}</td> + <td>{{Spec2('DOM1')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Firefox (Gecko)</th> + <th>Chrome</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Firefox Mobile (Gecko)</th> + <th>Android</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{domxref("DOMImplementation.createDocument", "document.implementation.createDocument()")}}</li> + <li>{{domxref("documentFragment")}}</li> +</ul> |