diff options
Diffstat (limited to 'files/pt-br/web/api/node/contains/index.html')
-rw-r--r-- | files/pt-br/web/api/node/contains/index.html | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/files/pt-br/web/api/node/contains/index.html b/files/pt-br/web/api/node/contains/index.html new file mode 100644 index 0000000000..e468ac6bd3 --- /dev/null +++ b/files/pt-br/web/api/node/contains/index.html @@ -0,0 +1,98 @@ +--- +title: Node.contains +slug: Web/API/Node/contains +translation_of: Web/API/Node/contains +--- +<div> +<div>{{ApiRef("DOM")}}</div> +</div> + +<h2 id="Summary" name="Summary">Sumário</h2> + +<p>Indica se um nó é um descendente de um dado nó.</p> + +<h2 id="Syntax" name="Syntax">Sintaxe</h2> + +<pre class="syntaxbox">node.contains( otherNode ) +</pre> + +<ul> + <li><code>node</code> é o nó que está sendo comparado.</li> + <li><code>otherNode</code> é o nó contra o qual está sendo comparado.</li> +</ul> + +<p>O valor de retorno é <code>true</code> se <code>otherNode</code> é um descendente de um nó ou o próprio nó. Caso contrário o valor de retorno é <code>false</code>.</p> + +<h2 id="Example" name="Example">Exemplo</h2> + +<p>Esta função verifica se um elemento está no corpo da página. As <code>contains</code> is inclusive and determining if the body contains itself isn't the intention of <code>isInPage</code> this case explicitly returns <code>false</code>.</p> + +<pre class="brush:js">function isInPage(node) { + return (node === document.body) ? false : document.body.contains(node); +}</pre> + +<ul> + <li><code>node</code> é o nó <span id="result_box" lang="pt"><span class="hps">que</span> <span class="hps">desejamos verificar</span> se está <span class="hps">no</span> </span><code><body></code>.</li> +</ul> + +<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Recurso</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Suporte básico</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("9.0")}}</td> + <td>5.0</td> + <td>{{CompatVersionUnknown}}</td> + <td>5.2.2 <a href="https://code.google.com/p/doctype-mirror/wiki/ArticleNodeContains" title="https://code.google.com/p/doctype-mirror/wiki/ArticleNodeContains">[1]</a><a href="https://github.com/okfn/annotator/blob/master/src/range.coffee#L366" title="https://github.com/okfn/annotator/blob/master/src/range.coffee#L366">[2]</a></td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Recurso</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Suporte básico</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoMobile("9.0")}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Specification" name="Specification">Especificação</h2> + +<ul> + <li><a class="external" href="http://www.w3.org/TR/domcore/#dom-node-contains" title="http://www.w3.org/TR/domcore/#dom-node-contains">DOM Level 4: contains</a></li> +</ul> + +<h2 id="See_also" name="See_also">Ver também</h2> + +<ul> + <li>{{domxref("Node.hasChildNodes")}}</li> +</ul> |