1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
---
title: document.createDocumentFragment
slug: Web/API/Document/createDocumentFragment
tags:
- DOM
- Dokumentacja_Gecko_DOM
- Gecko
- Wszystkie_kategorie
translation_of: Web/API/Document/createDocumentFragment
---
<p>{{ ApiRef() }}</p>
<h3 id="Podsumowanie" name="Podsumowanie">Podsumowanie</h3>
<p>Tworzy pusty fragment dokumentu.</p>
<h3 id="Sk.C5.82adnia" name="Sk.C5.82adnia">Składnia</h3>
<pre class="eval">var fragmentDokumentu = document.createDocumentFragment();
</pre>
<p><code>fragmentDokumentu</code> jest odniesieniem do pustego obiektu <code>DocumentFragment</code>.</p>
<h3 id="Przyk.C5.82ad" name="Przyk.C5.82ad">Przykład</h3>
<pre>var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode('Ipsum Lorem'));
document.body.appendChild(frag);
</pre>
<h3 id="Uwagi" name="Uwagi">Uwagi</h3>
<p><code><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-B63ED1A3">DocumentFragment</a></code> jest minimalnym obiektem dokumentu, który nie posiada rodzica. Obsługuje on następujące metody DOM 2: <code><a href="pl/DOM/element.appendChild">appendChild</a></code>, <code><a href="pl/DOM/element.cloneNode">cloneNode</a></code>, <code><a href="pl/DOM/element.hasAttributes">hasAttributes</a></code>, <code><a href="pl/DOM/element.hasChildNodes">hasChildNodes</a></code>, <code><a href="pl/DOM/element.insertBefore">insertBefore</a></code>, <code><a href="pl/DOM/element.normalize">normalize</a></code>, <code><a href="pl/DOM/element.removeChild">removeChild</a></code>, <code><a href="pl/DOM/element.replaceChild">replaceChild</a></code>.</p>
<p>Obsługuje on również następujące własności DOM 2: <code><a href="pl/DOM/element.attributes">attributes</a></code>, <code><a href="pl/DOM/element.childNodes">childNodes</a></code>, <code><a href="pl/DOM/element.firstChild">firstChild</a></code>, <code><a href="pl/DOM/element.lastChild">lastChild</a></code>, <code><a href="pl/DOM/element.localName">localName</a></code>, <code><a href="pl/DOM/element.namespaceURI">namespaceURI</a></code>, <code><a href="pl/DOM/element.nextSibling">nextSibling</a></code>, <code><a href="pl/DOM/element.nodeName">nodeName</a></code>, <code><a href="pl/DOM/element.nodeType">nodeType</a></code>, <code><a href="pl/DOM/element.nodeValue">nodeValue</a></code>, <code><a href="pl/DOM/element.ownerDocument">ownerDocument</a></code>, <code><a href="pl/DOM/element.parentNode">parentNode</a></code>, <code><a href="pl/DOM/element.prefix">prefix</a></code>, <code><a href="pl/DOM/element.previousSibling">previousSibling</a></code>, <code><a href="pl/DOM/element.textContent">textContent</a></code>.</p>
<p>Różne inne metody potrafią pobrać fragment dokumentu jako argument (na przykład metody interfejsu <code><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247">Node</a></code> takie jak <code><a href="pl/DOM/element.appendChild">appendChild</a></code> i <code><a href="pl/DOM/element.insertBefore">insertBefore</a></code>), w przypadku których dodawane lub wstawiane są dzieci fragmentu, nie zaś same fragmenty.</p>
<h3 id="Specyfikacja" name="Specyfikacja">Specyfikacja</h3>
<p><a class="external" href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-35CB04B5">createDocumentFragment</a></p>
<p>{{ languages( { "en": "en/DOM/document.createDocumentFragment" } ) }}</p>
|