From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/pt-br/web/api/node/contains/index.html | 98 ++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 files/pt-br/web/api/node/contains/index.html (limited to 'files/pt-br/web/api/node/contains/index.html') 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 +--- +
+
{{ApiRef("DOM")}}
+
+ +

Sumário

+ +

Indica se um nó é um descendente de um dado nó.

+ +

Sintaxe

+ +
node.contains( otherNode )
+
+ + + +

O valor de retorno é true se otherNode é um descendente de um nó ou o próprio nó. Caso contrário o valor de retorno é false.

+ +

Exemplo

+ +

Esta função verifica se um elemento está no corpo da página. As contains is inclusive and determining if the body contains itself isn't the intention of isInPage this case explicitly returns false.

+ +
function isInPage(node) {
+  return (node === document.body) ? false : document.body.contains(node);
+}
+ + + +

Browser compatibility

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
RecursoChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suporte básico{{CompatVersionUnknown}}{{CompatGeckoDesktop("9.0")}}5.0{{CompatVersionUnknown}}5.2.2 [1][2]
+
+ +
+ + + + + + + + + + + + + + + + + + + +
RecursoAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suporte básico{{CompatUnknown}}{{CompatGeckoMobile("9.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

Especificação

+ + + +

Ver também

+ + -- cgit v1.2.3-54-g00ecf