diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/api/documentfragment | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/pt-br/web/api/documentfragment')
-rw-r--r-- | files/pt-br/web/api/documentfragment/index.html | 234 |
1 files changed, 234 insertions, 0 deletions
diff --git a/files/pt-br/web/api/documentfragment/index.html b/files/pt-br/web/api/documentfragment/index.html new file mode 100644 index 0000000000..5744ea8afe --- /dev/null +++ b/files/pt-br/web/api/documentfragment/index.html @@ -0,0 +1,234 @@ +--- +title: DocumentFragment +slug: Web/API/DocumentFragment +translation_of: Web/API/DocumentFragment +--- +<p>{{ ApiRef("DOM") }}</p> + +<p>A interface do <strong>DocumentFragment </strong>representa um objeto de documento mínimo que não possui pai. Ela é utilizada como uma versão leve de {{domxref("Document")}} para armazenar fragmentos bem formados ou fragments potencialmente mal formados de XML.</p> + +<p>Vários outros métodos podem usar um document fragment como argumento (ex. qualquer interface de {{domxref("Node")}} como {{domxref("Node.appendChild")}} e {{domxref("Node.insertBefore")}}) em casos em que os filhos do fragment são acrescentados ou inseridos, e não o próprio fragment.</p> + +<p>Essa interface também é excelente para ser usada com Web components: elementos {{HTMLElement("template")}} contém um <code>DocumentFragment</code> na propriedade {{domxref("HTMLTemplateElement.content")}} deles.</p> + +<p>Um DocumentFragment pode ser criado usando o método {{domxref("document.createDocumentFragment")}} ou o construtor.</p> + +<h2 id="Specification" name="Specification">Propriedades</h2> + +<p><em>Essa interface não tem uma propriedade específica, mas herda de seu pai, </em><em>{{domxref("Node")}}, e implementa aquelas da interface {{domxref("ParentNode")}}.</em></p> + +<dl> + <dt>{{ domxref("ParentNode.children") }} {{readonlyInline}}{{experimental_inline}}</dt> + <dd>Returns a live {{domxref("HTMLCollection")}} containing all objects of type {{domxref("Node")}} that are children of the <code>DocumentFragment</code> object.</dd> + <dt>{{ domxref("ParentNode.firstElementChild") }} {{readonlyInline}}{{experimental_inline}}</dt> + <dd>Returns the {{domxref("Element")}} that is the first child of the <code>DocumentFragment</code> object, or <code>null</code> if there is none.</dd> + <dt>{{ domxref("ParentNode.lastElementChild") }} {{readonlyInline}}{{experimental_inline}}</dt> + <dd>Returns the {{domxref("Element")}} that is the last child of the <code>DocumentFragment</code> object, or <code>null</code> if there is none.</dd> + <dt>{{ domxref("ParentNode.childElementCount") }} {{readonlyInline}}{{experimental_inline}}</dt> + <dd>Returns an <code>unsigned long</code> giving the amount of children that the <code>DocumentFragment</code> has.</dd> +</dl> + +<h2 id="Construtor">Construtor</h2> + +<dl> + <dt>{{ domxref("DocumentFragment.DocumentFragment()", "DocumentFragment()") }} {{experimental_inline}}</dt> + <dd>Retorna um objeto <span style="font-family: courier new,andale mono,monospace; line-height: 1.5;">DocumentFragment </span><span style="line-height: 1.5;">vazio.</span></dd> +</dl> + +<h2 id="Métodos">Métodos</h2> + +<p><em>This interface inherits the methods of its parent, {{domxref("Node")}}<em>, and implements those of the {{domxref("ParentNode")}} interface</em></em><em>.</em></p> + +<dl> + <dt>{{domxref("DocumentFragment.find()")}} {{experimental_inline}}</dt> + <dd>Returns the first matching {{domxref("Element")}} in the tree of the <code>DocumentFragment</code>.</dd> + <dt>{{domxref("DocumentFragment.findAll()")}} {{experimental_inline}}</dt> + <dd>Returns a {{domxref("NodeList")}} of matching {{domxref("Element")}} in the tree of the <code>DocumentFragment</code>.</dd> + <dt>{{domxref("DocumentFragment.querySelector()")}}</dt> + <dd>Returns the first {{domxref("Element")}} node within the <code>DocumentFragment</code>, in document order, that matches the specified selectors.</dd> + <dt>{{domxref("DocumentFragment.querySelectorAll()")}}</dt> + <dd>Returns a {{domxref("NodeList")}} of all the {{domxref("Element")}} nodes within the <code>DocumentFragment</code> that match the specified selectors.</dd> +</dl> + +<dl> + <dt>{{domxref("DocumentFragment.getElementById()")}}</dt> + <dd>Returns the first {{domxref("Element")}} node within the <code style="font-size: 14px;">DocumentFragment</code>, in document order, that matches the specified ID.</dd> +</dl> + +<h2 id="Specification" name="Specification">Especificações</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', '#documentfragment', 'DocumentFragment')}}</td> + <td>{{Spec2('DOM WHATWG')}}</td> + <td>Added the constructor and the implementation of {{domxref("ParentNode")}}.</td> + </tr> + <tr> + <td>{{SpecName('Selectors API Level 2', '#the-apis', 'DocumentFragment')}}</td> + <td>{{Spec2('Selectors API Level 2')}}</td> + <td>Added the <code>find()</code> and <code>findAll()</code> methods.</td> + </tr> + <tr> + <td>{{SpecName('Selectors API Level 1', '#the-apis', 'DocumentFragment')}}</td> + <td>{{Spec2('Selectors API Level 1')}}</td> + <td>Added the <code>querySelector()</code> and <code>querySelectorAll()</code> methods.</td> + </tr> + <tr> + <td>{{SpecName('DOM3 Core', 'core.html#ID-B63ED1A3', 'DocumentFragment')}}</td> + <td>{{Spec2('DOM3 Core')}}</td> + <td>No change from {{SpecName('DOM2 Core')}}</td> + </tr> + <tr> + <td>{{SpecName('DOM2 Core', 'core.html#ID-B63ED1A3', 'DocumentFragment')}}</td> + <td>{{Spec2('DOM2 Core')}}</td> + <td>No change from {{SpecName('DOM1')}}</td> + </tr> + <tr> + <td>{{SpecName('DOM1', 'level-one-core.html#ID-B63ED1A3', 'DocumentFragment')}}</td> + <td>{{Spec2('DOM1')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>1.0</td> + <td>{{CompatGeckoDesktop("1.0")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + <tr> + <td><code>querySelector()</code> and <code>querySelectorAll()</code></td> + <td>1.0</td> + <td>{{CompatGeckoDesktop("1.9.1")}}</td> + <td>8.0</td> + <td>10.0</td> + <td>3.2 (525.3)</td> + </tr> + <tr> + <td><code>findAll()</code> and <code>find() </code>{{experimental_inline}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td><code>DocumentFragment()</code> constructor {{experimental_inline}}</td> + <td>28.0</td> + <td>{{CompatGeckoDesktop("24.0")}}</td> + <td>{{CompatNo}}</td> + <td>15.0</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td><code>ParentNode</code> properties {{experimental_inline}}</td> + <td>28.0</td> + <td>{{CompatGeckoDesktop("25.0")}}</td> + <td>{{CompatNo}}</td> + <td>15.0</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td><code>ParentNode</code> methods {{experimental_inline}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("1.0")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + <tr> + <td><code>querySelector()</code> and <code>querySelectorAll()</code></td> + <td>2.1</td> + <td>{{CompatGeckoDesktop("1.9.1")}}</td> + <td>8.0</td> + <td>10.0</td> + <td>3.2 (525.3)</td> + </tr> + <tr> + <td><code>findAll()</code> and <code>find() </code>{{experimental_inline}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td><code>DocumentFragment()</code> constructor {{experimental_inline}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoMobile("24.0")}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>ParentNode</code> properties {{experimental_inline}}</td> + <td>28.0</td> + <td>{{CompatGeckoMobile("25.0")}}</td> + <td>{{CompatNo}}</td> + <td>5.0</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td><code>ParentNode</code> methods {{experimental_inline}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li><a href="/en-US/docs/DOM/DOM_Reference" title="/en-US/docs/DOM/DOM_Reference">The DOM interfaces index.</a></li> +</ul> |