From f11661ca61cbf22e2544a485922bac03486749a2 Mon Sep 17 00:00:00 2001 From: "Queen Vinyl Da.i'gyu-Kazotetsu" Date: Fri, 28 Jul 2023 10:10:55 -0700 Subject: [PATCH] pt-br: Format /web/api using Prettier (part 2) --- files/pt-br/web/api/document/head/index.md | 8 +- files/pt-br/web/api/document/images/index.md | 16 +- .../web/api/document/implementation/index.md | 13 +- .../web/api/document/importnode/index.md | 11 +- .../pt-br/web/api/document/location/index.md | 7 +- .../document/readystatechange_event/index.md | 18 +- files/pt-br/web/api/document/url/index.md | 10 +- files/pt-br/web/api/document/write/index.md | 41 +- .../document_object_model/examples/index.md | 566 ++++++++++-------- .../how_to_create_a_dom_tree/index.md | 80 +-- .../introduction/index.md | 72 ++- .../document_object_model/whitespace/index.md | 88 ++- files/pt-br/web/api/documentfragment/index.md | 11 +- .../domimplementation/createdocument/index.md | 22 +- .../pt-br/web/api/domimplementation/index.md | 11 +- files/pt-br/web/api/domstringlist/index.md | 8 +- files/pt-br/web/api/element/animate/index.md | 31 +- .../pt-br/web/api/element/attributes/index.md | 78 ++- .../pt-br/web/api/element/blur_event/index.md | 40 +- .../api/element/childelementcount/index.md | 30 +- .../pt-br/web/api/element/classlist/index.md | 12 +- .../pt-br/web/api/element/classname/index.md | 8 +- .../web/api/element/click_event/index.md | 42 +- files/pt-br/web/api/element/closest/index.md | 60 +- .../api/element/contextmenu_event/index.md | 22 +- .../web/api/element/focus_event/index.md | 16 +- .../web/api/element/focusin_event/index.md | 16 +- .../web/api/element/focusout_event/index.md | 12 +- .../element/getboundingclientrect/index.md | 32 +- .../element/getelementsbyclassname/index.md | 39 +- files/pt-br/web/api/element/id/index.md | 8 +- files/pt-br/web/api/element/index.md | 19 +- .../pt-br/web/api/element/innerhtml/index.md | 14 +- .../api/element/insertadjacenthtml/index.md | 20 +- .../element/lostpointercapture_event/index.md | 6 +- files/pt-br/web/api/element/matches/index.md | 14 +- .../web/api/element/mousedown_event/index.md | 42 +- .../web/api/element/mouseenter_event/index.md | 105 ++-- .../web/api/element/mouseover_event/index.md | 88 +-- .../pt-br/web/api/element/outerhtml/index.md | 10 +- .../web/api/element/queryselector/index.md | 4 +- .../web/api/element/queryselectorall/index.md | 16 +- .../web/api/element/scroll_event/index.md | 9 +- .../web/api/element/scrollintoview/index.md | 10 +- .../pt-br/web/api/element/scrollleft/index.md | 55 +- .../pt-br/web/api/element/scrolltop/index.md | 8 +- .../web/api/element/scrollwidth/index.md | 92 ++- files/pt-br/web/api/element/tagname/index.md | 7 +- .../web/api/element/touchstart_event/index.md | 19 +- files/pt-br/web/api/encoding_api/index.md | 15 +- .../comparison_of_event_targets/index.md | 8 +- .../web/api/event/currenttarget/index.md | 19 +- files/pt-br/web/api/event/event/index.md | 8 +- files/pt-br/web/api/event/initevent/index.md | 7 +- files/pt-br/web/api/event/istrusted/index.md | 7 +- .../web/api/event/preventdefault/index.md | 75 +-- .../event/stopimmediatepropagation/index.md | 9 +- files/pt-br/web/api/event/target/index.md | 12 +- files/pt-br/web/api/event/type/index.md | 58 +- .../web/api/eventsource/error_event/index.md | 8 +- .../web/api/eventsource/eventsource/index.md | 14 +- files/pt-br/web/api/eventsource/index.md | 14 +- .../api/eventtarget/addeventlistener/index.md | 207 ++++--- .../web/api/eventtarget/eventtarget/index.md | 18 +- files/pt-br/web/api/eventtarget/index.md | 8 +- .../eventtarget/removeeventlistener/index.md | 82 +-- files/pt-br/web/api/fetch/index.md | 52 +- .../cross-global_fetch_usage/index.md | 4 +- files/pt-br/web/api/fetch_api/index.md | 6 +- .../web/api/fetch_api/using_fetch/index.md | 133 ++-- files/pt-br/web/api/file/index.md | 4 +- .../index.md | 279 +++++---- files/pt-br/web/api/filelist/index.md | 57 +- .../web/api/filereader/filereader/index.md | 10 +- files/pt-br/web/api/filereader/index.md | 8 +- .../web/api/filereader/load_event/index.md | 4 +- .../api/filereader/readasarraybuffer/index.md | 6 +- .../filereader/readasbinarystring/index.md | 18 +- .../web/api/filereader/readastext/index.md | 6 +- files/pt-br/web/api/formdata/append/index.md | 10 +- files/pt-br/web/api/formdata/delete/index.md | 10 +- files/pt-br/web/api/formdata/entries/index.md | 14 +- .../pt-br/web/api/formdata/formdata/index.md | 20 +- files/pt-br/web/api/formdata/get/index.md | 12 +- files/pt-br/web/api/formdata/getall/index.md | 14 +- files/pt-br/web/api/formdata/has/index.md | 12 +- files/pt-br/web/api/formdata/index.md | 6 +- files/pt-br/web/api/formdata/set/index.md | 10 +- files/pt-br/web/api/gamepad_api/index.md | 7 +- .../web/api/geolocation/clearwatch/index.md | 20 +- .../geolocation/getcurrentposition/index.md | 24 +- files/pt-br/web/api/geolocation/index.md | 6 +- .../api/geolocation/watchposition/index.md | 18 +- files/pt-br/web/api/geolocation_api/index.md | 138 +++-- .../geolocationcoordinates/altitude/index.md | 4 +- .../web/api/geolocationcoordinates/index.md | 8 +- .../api/geolocationposition/coords/index.md | 6 +- .../web/api/geolocationposition/index.md | 4 +- .../web/api/geolocationpositionerror/index.md | 14 +- files/pt-br/web/api/history/index.md | 10 +- 100 files changed, 1741 insertions(+), 1748 deletions(-) diff --git a/files/pt-br/web/api/document/head/index.md b/files/pt-br/web/api/document/head/index.md index 2132c8710a14c1..2a2212909568e8 100644 --- a/files/pt-br/web/api/document/head/index.md +++ b/files/pt-br/web/api/document/head/index.md @@ -21,7 +21,7 @@ var aHead = document.head; alert(aHead.id); // "my-document-head"; -alert( document.head === document.querySelector("head") ); // true +alert(document.head === document.querySelector("head")); // true ``` ## Notas @@ -30,13 +30,11 @@ alert( document.head === document.querySelector("head") ); // true ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------------------ | ---------------------------- | ----------------- | -| {{SpecName("HTML5 W3C", "dom.html#dom-tree-accessors", "document.head")}} | {{Spec2("HTML5 W3C")}} | Definição inicial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Document.head")}} +{{Compat}} ## Veja Também diff --git a/files/pt-br/web/api/document/images/index.md b/files/pt-br/web/api/document/images/index.md index ecb31791c3f807..6f4d368d90aedf 100644 --- a/files/pt-br/web/api/document/images/index.md +++ b/files/pt-br/web/api/document/images/index.md @@ -20,10 +20,10 @@ var htmlCollection = document.images; ```js var ilist = document.images; -for(var i = 0; i < ilist.length; i++) { - if(ilist[i].src == "banner.gif") { - // found the banner - } +for (var i = 0; i < ilist.length; i++) { + if (ilist[i].src == "banner.gif") { + // found the banner + } } ``` @@ -33,6 +33,10 @@ for(var i = 0; i < ilist.length; i++) { `document.images` é parte do DOM HTML, e só trabalho com documentos HTML. -## Especificação +## Especificações -- [DOM Level 2 HTML: HTMLDocument.images](https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-90379117) +{{Specifications}} + +## Compatibilidade com navegadores + +{{Compat}} diff --git a/files/pt-br/web/api/document/implementation/index.md b/files/pt-br/web/api/document/implementation/index.md index 2bd07a41a4600c..98e9c390544b83 100644 --- a/files/pt-br/web/api/document/implementation/index.md +++ b/files/pt-br/web/api/document/implementation/index.md @@ -20,9 +20,9 @@ DOMImpObj = document.implementation; ```js var modName = "HTML"; var modVer = "2.0"; -var conformTest = document.implementation.hasFeature( modName, modVer ); +var conformTest = document.implementation.hasFeature(modName, modVer); -alert( "DOM " + modName + " " + modVer + " supported?: " + conformTest ); +alert("DOM " + modName + " " + modVer + " supported?: " + conformTest); // alerts with: "DOM HTML 2.0 supported?: true" if DOM Level 2 HTML module is supported. ``` @@ -33,11 +33,10 @@ Uma lista dos nomes de módulos (ex., Core, HTML, XML, etc) está disponível na A Recomendação do W3C DOM Level 1 apenas especifica o método `hasFeature`, que é o único meio de verificar se o módulo DOM é suportado pelo navegador (veja exemplo acima e [What does your user agent claim to support?](https://www.w3.org/2003/02/06-dom-support.html)). Quando disponível, outros métodos `DOMImplementation` proverão serviços para controlar coisas fora deste único documento. Por exemplo, a interface `DOMImplementation` inclui um método `createDocumentType` com o qual DTD's podem ser criados para um ou mais documentos gerenciados pela implementação. -## Especificação +## Especificações -- [DOM Level 2 Core: implementation](https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490) -- [DOM Level 3 Core: implementation](https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490) +{{Specifications}} -## Notas específicas para o Gecko +## Compatibilidade com navegadores -- À partir do Gecko 19.0 o método {{domxref("DOMImplementation.hasFeature","hasFeature")}} irá sempre retornar _true_. +{{Compat}} diff --git a/files/pt-br/web/api/document/importnode/index.md b/files/pt-br/web/api/document/importnode/index.md index 224bd062415a20..2e20d2710927e5 100644 --- a/files/pt-br/web/api/document/importnode/index.md +++ b/files/pt-br/web/api/document/importnode/index.md @@ -41,16 +41,13 @@ Nodes from external documents should be cloned using [`document.importNode()`](/ Firefox doesn't currently enforce this rule (it did for a while during the development of Firefox 3, but too many sites break when this rule is enforced). We encourage Web developers to fix their code to follow this rule for improved future compatibility. -## Especificação +## Especificações -| Specification | Status | Comment | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | -| {{SpecName("DOM WHATWG", "#dom-document-importnode", "document.importNode()")}} | {{Spec2("DOM WHATWG")}} | | -| {{SpecName("DOM2 Core", "core.html#Core-Document-importNode", "document.importNode()")}} | {{Spec2("DOM2 Core")}} | Initial definition | +{{Specifications}} -## Compatibilidade nos Browsers +## Compatibilidade com navegadores -{{Compat("api.Document.importNode")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/document/location/index.md b/files/pt-br/web/api/document/location/index.md index cc111651934e7c..516cf329f0aaba 100644 --- a/files/pt-br/web/api/document/location/index.md +++ b/files/pt-br/web/api/document/location/index.md @@ -30,14 +30,11 @@ dump(document.location); ## Especificações -| Especificação | Status | Comentário | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ---------------------------------------------------- | -| {{SpecName('HTML WHATWG', "history.html#the-location-interface", "Document.location")}} | {{Spec2('HTML WHATWG')}} | Nenhuma mudança de {{SpecName("HTML5 W3C")}}. | -| {{SpecName('HTML5 W3C', "browsers.html#the-location-interface", "Document.location")}} | {{Spec2('HTML5 W3C')}} | Definição inicial. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Document.location")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/document/readystatechange_event/index.md b/files/pt-br/web/api/document/readystatechange_event/index.md index 9c71f12b3193e1..f7aeb131b06c38 100644 --- a/files/pt-br/web/api/document/readystatechange_event/index.md +++ b/files/pt-br/web/api/document/readystatechange_event/index.md @@ -25,22 +25,22 @@ O evento `readystatechange` é ativado quando o atributo [`readyState`](/pt-BR/d ## Propriedades -| Property | Type | Description | -| ------------------------------------- | ------------------------------------ | ------------------------------------------------------ | +| Property | Type | Description | +| ------------------------------- | -------------------------- | ------------------------------------------------------ | | `target` {{readonlyInline}} | {{domxref("EventTarget")}} | The event target (the topmost target in the DOM tree). | -| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | -| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | -| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | +| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | +| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | +| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | ## Exemplo ```js // alternativa ao DOMContentLoaded document.onreadystatechange = function () { - if (document.readyState == "interactive") { - initApplication(); - } -} + if (document.readyState == "interactive") { + initApplication(); + } +}; ``` ## Compatibilidade com navegadores diff --git a/files/pt-br/web/api/document/url/index.md b/files/pt-br/web/api/document/url/index.md index f99c807e59dbea..8d5ad280b039e7 100644 --- a/files/pt-br/web/api/document/url/index.md +++ b/files/pt-br/web/api/document/url/index.md @@ -10,9 +10,13 @@ A propriedade **`URL`** (usada apenas para leitura) da Interface {{domxref("Docu ## Síntaxe ```js -var url_atual = document.URL +var url_atual = document.URL; ``` -## Documentação +## Especificações -- [DOM - Nível 2 - HTML: URL](https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-46183437) +{{Specifications}} + +## Compatibilidade com navegadores + +{{Compat}} diff --git a/files/pt-br/web/api/document/write/index.md b/files/pt-br/web/api/document/write/index.md index 9ddc64489306b8..b30367194a175d 100644 --- a/files/pt-br/web/api/document/write/index.md +++ b/files/pt-br/web/api/document/write/index.md @@ -24,23 +24,21 @@ document.write(markup); ```html - - - Escreva exemplo - - - - - -

Algum conteúdo do documento original.

- - + + Escreva exemplo + + + + + +

Algum conteúdo do documento original.

+ ``` @@ -54,7 +52,7 @@ Se chamar `document.write()` incorporada em uma tag HTML ` ``` @@ -68,14 +66,11 @@ Se chamar `document.write()` incorporada em uma tag HTML ` - - - -

Image 1: no height, width, or style - -

- -

Image 2: height="50", width="500", but no style - -

- -

Image 3: no height, width, but style="height: 50px; width: 500px;" - -

- -
- + } + + strHtml += "<\/ul>"; + + objOutput.innerHTML = strHtml; + } + + + +

+ Image 1: no height, width, or style + +

+ +

+ Image 2: height="50", width="500", but no style + +

+ +

+ Image 3: no height, width, but style="height: 50px; width: 500px;" + +

+ +
+ ``` ## Exemplo 2: Atributos de Imagem ```html - + - -Modifying an image border - - - - - -

- border test -

- -
- - -
- - + + Modifying an image border + + + + + +

+ border test +

+ +
+ + +
+ ``` @@ -101,29 +120,29 @@ function setBorderWidth(width) { Neste exemplo simples, algumas propriedades de estilo básicas de um elemento de parágrafo HTML são acessadas usando o objeto de estilo no elemento e as propriedades de estilo CSS do objeto, que podem ser recuperadas e definidas a partir do DOM. Neste caso, você está manipulando os estilos individuais diretamente. No próximo exemplo (veja Exemplo 4), você pode usar folhas de estilo e suas regras para alterar estilos para documentos inteiros. ```html - + - -Changing color and font-size example - - - - - -

linker

- -
-

-
- - + + Changing color and font-size example + + + + +

+ linker +

+ +
+

+
+ ``` @@ -134,9 +153,9 @@ A propriedade styleSheets no objeto de documento retorna uma lista das folhas de ```js var ss = document.styleSheets; -for(var i = 0; i < ss.length; i++) { - for(var j = 0; j < ss[i].cssRules.length; j++) { - dump( ss[i].cssRules[j].selectorText + "\n" ); +for (var i = 0; i < ss.length; i++) { + for (var j = 0; j < ss[i].cssRules.length; j++) { + dump(ss[i].cssRules[j].selectorText + "\n"); } } ``` @@ -144,9 +163,17 @@ for(var i = 0; i < ss.length; i++) { Para um documento com uma única folha de estilo na qual as três regras a seguir são definidas: ```css -body { background-color: darkblue; } -p { font-face: Arial; font-size: 10pt; margin-left: .125in; } -#lumpy { display: none; } +body { + background-color: darkblue; +} +p { + font-face: Arial; + font-size: 10pt; + margin-left: 0.125in; +} +#lumpy { + display: none; +} ``` Este script produz o seguinte: @@ -164,45 +191,47 @@ Este exemplo demonstra como eventos disparar e são tratados no DOM de uma forma No entanto, stopEvent também chama um método de objeto de evento, {{domxref ("event.stopPropagation")}}, que mantém o evento de borbulhar mais para cima no DOM. Observe que a própria tabela possui um manipulador de eventos {{domxref ("element.onclick", "onclick")}} que deve exibir uma mensagem quando a tabela é clicada. Mas o método stopEvent interrompeu a propagação e, portanto, após a atualização dos dados na tabela, a fase de evento é efetivamente encerrada e uma caixa de alerta é exibida para confirmar isso. ```html - + - -Event Propagation - - - - - - - - - - - - - - - -
one
two
- - + + Event Propagation + + + + + + + + + + + + + + +
one
two
+ ``` @@ -213,57 +242,61 @@ Este exemplo demonstra como o método {{domxref ("window.getComputedStyle")}} po GetComputedStyle() retorna um objeto ComputedCSSStyleDeclaration, cujas propriedades de estilo individuais podem ser referenciadas com o método getPropertyValue() desse objeto, como mostra o seguinte exemplo de documento. ```html - + - - -getComputedStyle example - - - - - - - - - -
 
- -
-

- - height - max-width - bg-color -

-
- - + + getComputedStyle example + + + + + + + +
 
+ +
+

+ + height max-width + bg-color +

+
+ ``` @@ -276,66 +309,74 @@ As propriedades dos objetos de evento diferem muito entre os navegadores, o [WHA Coloque o seguinte código em um arquivo de texto em branco e carregue-o em uma variedade de navegadores, você ficará surpreso com o número diferente e nomes de propriedades. Você também pode querer adicionar alguns elementos na página e chamar essa função de manipuladores de eventos diferentes. ```html - + - - -Show Event properties - - - - - - - -

Properties of the DOM Event Object

- - + + + Show Event properties + + + + + + + +

Properties of the DOM Event Object

+ ``` @@ -347,27 +388,26 @@ Para adicionar uma linha e algumas células a uma tabela existente: ```html - - - - + + + +
Row 0 Cell 0Row 0 Cell 1
Row 0 Cell 0Row 0 Cell 1
``` -###
Notas +### Notas - A propriedade {{domxref ("element.innerHTML", "innerHTML")}} de uma tabela nunca deve ser usada para modificar uma tabela, embora você possa usá-la para escrever uma tabela inteira ou o conteúdo de uma célula. - Se os métodos DOM Core {{domxref ("document.createElement")}} e {{domxref ("Node.appendChild")}} são usados para criar linhas e células, o IE requer que eles sejam anexados a um elemento tbody, enquanto outros Os navegadores permitirão acrescentar a um elemento da tabela (as linhas serão adicionadas ao último elemento tbody). diff --git a/files/pt-br/web/api/document_object_model/how_to_create_a_dom_tree/index.md b/files/pt-br/web/api/document_object_model/how_to_create_a_dom_tree/index.md index bcd1209604235b..e1dd5d0d923fdd 100644 --- a/files/pt-br/web/api/document_object_model/how_to_create_a_dom_tree/index.md +++ b/files/pt-br/web/api/document_object_model/how_to_create_a_dom_tree/index.md @@ -89,41 +89,51 @@ Você pode automatizar a criação de uma árvore DOM usando um [algoritmo rever ```json { "people": { - "person": [{ - "address": [{ - "@street": "321 south st", - "@city": "denver", - "@state": "co", - "@country": "usa" - }, { - "@street": "123 main st", - "@city": "arlington", - "@state": "ma", - "@country": "usa" - }], - "@first-name": "eric", - "@middle-initial": "H", - "@last-name": "jung" - }, { - "address": [{ - "@street": "321 north st", - "@city": "atlanta", - "@state": "ga", - "@country": "usa" - }, { - "@street": "123 west st", - "@city": "seattle", - "@state": "wa", - "@country": "usa" - }, { - "@street": "321 south avenue", - "@city": "denver", - "@state": "co", - "@country": "usa" - }], - "@first-name": "jed", - "@last-name": "brown" - }] + "person": [ + { + "address": [ + { + "@street": "321 south st", + "@city": "denver", + "@state": "co", + "@country": "usa" + }, + { + "@street": "123 main st", + "@city": "arlington", + "@state": "ma", + "@country": "usa" + } + ], + "@first-name": "eric", + "@middle-initial": "H", + "@last-name": "jung" + }, + { + "address": [ + { + "@street": "321 north st", + "@city": "atlanta", + "@state": "ga", + "@country": "usa" + }, + { + "@street": "123 west st", + "@city": "seattle", + "@state": "wa", + "@country": "usa" + }, + { + "@street": "321 south avenue", + "@city": "denver", + "@state": "co", + "@country": "usa" + } + ], + "@first-name": "jed", + "@last-name": "brown" + } + ] } } ``` diff --git a/files/pt-br/web/api/document_object_model/introduction/index.md b/files/pt-br/web/api/document_object_model/introduction/index.md index 5ca9304bcbcc20..a635f41e1af828 100644 --- a/files/pt-br/web/api/document_object_model/introduction/index.md +++ b/files/pt-br/web/api/document_object_model/introduction/index.md @@ -56,7 +56,7 @@ Quando você cria um script - seja embutido em um elemento(tag) ` - - + ``` @@ -243,35 +241,47 @@ Você pode usar essa página teste ou criar uma similar para testar as interface Testes DOM
-

text

+

+ text +

- -

bgColor

- -

link

- - - (link)
+ + + + + + (link)
diff --git a/files/pt-br/web/api/document_object_model/whitespace/index.md b/files/pt-br/web/api/document_object_model/whitespace/index.md index 0b72fb3fb6cfe0..5b67e215e5df4c 100644 --- a/files/pt-br/web/api/document_object_model/whitespace/index.md +++ b/files/pt-br/web/api/document_object_model/whitespace/index.md @@ -16,15 +16,13 @@ Em outras palavras, a árvore do DOM para o documento seguinte irá parecer como ```html - - Meu documento - - -

Cabeçalho

-

- Parágrafo -

- + + Meu documento + + +

Cabeçalho

+

Parágrafo

+ ``` @@ -41,22 +39,22 @@ Isto pode fazer as coisas um pouco difíceis para qualquer usuário do DOM que q com espaços brancos (whitespaces) entre as tags: -->
-
    -
  • Posição 1
  • -
  • Posição 2
  • -
  • Posição 3
  • -
+
    +
  • Posição 1
  • +
  • Posição 2
  • +
  • Posição 3
  • +
-
  • Posição 1
  • Posição 2
  • Posição 3
+
+
    +
  • Posição 1
  • +
  • Posição 2
  • +
  • Posição 3
  • +
+
``` O código Javascript abaixo define funções diversas que fazem a manipulação de [whitespace](/pt-BR/docs/Web/API/Document_Object_Model/Whitespace_in_the_DOM) no DOM mais fácil. @@ -73,7 +71,6 @@ O código Javascript abaixo define funções diversas que fazem a manipulação * que não quebram (e alguns outros caracteres). */ - /** * Determina se um conteúdo de texto do nó é inteiramente whitespace. * @@ -82,13 +79,11 @@ O código Javascript abaixo define funções diversas que fazem a manipulação * @return Verdadeiro se todo conteúdo de texto de |nod| é whitespace, * de outra forma é falso. */ -function is_all_ws( nod ) -{ +function is_all_ws(nod) { // Usa as características do ECMA-262 Edition 3 String e RegExp - return !(/[^\t\n\r ]/.test(nod.textContent)); + return !/[^\t\n\r ]/.test(nod.textContent); } - /** * Determina se um nó deve ser ignorado pela função de iterador. * @@ -99,10 +94,11 @@ function is_all_ws( nod ) * do contrário é falso. */ -function is_ignorable( nod ) -{ - return ( nod.nodeType == 8) || // Um nó de comentário - ( (nod.nodeType == 3) && is_all_ws(nod) ); // um nó de texto, todo whitespace +function is_ignorable(nod) { + return ( + nod.nodeType == 8 || // Um nó de comentário + (nod.nodeType == 3 && is_all_ws(nod)) + ); // um nó de texto, todo whitespace } /** @@ -118,8 +114,7 @@ function is_ignorable( nod ) * ignorável de acordo com |is_ignorable|, ou * 2) nulo se tal nó não existe. */ -function node_before( sib ) -{ +function node_before(sib) { while ((sib = sib.previousSibling)) { if (!is_ignorable(sib)) return sib; } @@ -136,8 +131,7 @@ function node_before( sib ) * ignorável de acordo com |is_ignorable|, ou * 2) nulo se tal nó não existe. */ -function node_after( sib ) -{ +function node_after(sib) { while ((sib = sib.nextSibling)) { if (!is_ignorable(sib)) return sib; } @@ -156,9 +150,8 @@ function node_after( sib ) * ignorável de acordo com |is_ignorable|, ou * 2) nulo se tal nó não existe. */ -function last_child( par ) -{ - var res=par.lastChild; +function last_child(par) { + var res = par.lastChild; while (res) { if (!is_ignorable(res)) return res; res = res.previousSibling; @@ -176,9 +169,8 @@ function last_child( par ) * ignorável de acordo com |is_ignorable|, ou * 2) nulo se tal nó não existe. */ -function first_child( par ) -{ - var res=par.firstChild; +function first_child(par) { + var res = par.firstChild; while (res) { if (!is_ignorable(res)) return res; res = res.nextSibling; @@ -195,13 +187,11 @@ function first_child( par ) * @return Uma string dando os conteúdos de um nó de texto com * whitespace colapsado. */ -function data_of( txt ) -{ +function data_of(txt) { var data = txt.textContent; // Usa características do ECMA-262 Edition 3 String e RegExp data = data.replace(/[\t\n\r ]+/g, " "); - if (data.charAt(0) == " ") - data = data.substring(1, data.length); + if (data.charAt(0) == " ") data = data.substring(1, data.length); if (data.charAt(data.length - 1) == " ") data = data.substring(0, data.length - 1); return data; @@ -214,12 +204,10 @@ O código seguinte demonstra o uso das funções acima. Ele itera através dos f ```js var cur = first_child(document.getElementById("teste")); -while (cur) -{ - if (data_of(cur.firstChild) == "Este é o terceiro parágrafo.") - { - cur.className = "mágica"; - cur.firstChild.textContent = "Este é o parágrafo mágico"; +while (cur) { + if (data_of(cur.firstChild) == "Este é o terceiro parágrafo.") { + cur.className = "mágica"; + cur.firstChild.textContent = "Este é o parágrafo mágico"; } cur = node_after(cur); } diff --git a/files/pt-br/web/api/documentfragment/index.md b/files/pt-br/web/api/documentfragment/index.md index bbb6cfa09c58ca..179dc496034947 100644 --- a/files/pt-br/web/api/documentfragment/index.md +++ b/files/pt-br/web/api/documentfragment/index.md @@ -48,18 +48,11 @@ _This interface inherits the methods of its parent, {{domxref("Node")}}_, and im ## Especificações -| Specification | Status | Comment | -| ---------------------------------------------------------------------------------------------------- | -------------------------------------------- | --------------------------------------------------------------------------------- | -| {{SpecName('DOM WHATWG', '#documentfragment', 'DocumentFragment')}} | {{Spec2('DOM WHATWG')}} | Added the constructor and the implementation of {{domxref("ParentNode")}}. | -| {{SpecName('Selectors API Level 2', '#the-apis', 'DocumentFragment')}} | {{Spec2('Selectors API Level 2')}} | Added the `find()` and `findAll()` methods. | -| {{SpecName('Selectors API Level 1', '#the-apis', 'DocumentFragment')}} | {{Spec2('Selectors API Level 1')}} | Added the `querySelector()` and `querySelectorAll()` methods. | -| {{SpecName('DOM3 Core', 'core.html#ID-B63ED1A3', 'DocumentFragment')}} | {{Spec2('DOM3 Core')}} | No change from {{SpecName('DOM2 Core')}} | -| {{SpecName('DOM2 Core', 'core.html#ID-B63ED1A3', 'DocumentFragment')}} | {{Spec2('DOM2 Core')}} | No change from {{SpecName('DOM1')}} | -| {{SpecName('DOM1', 'level-one-core.html#ID-B63ED1A3', 'DocumentFragment')}} | {{Spec2('DOM1')}} | Initial definition | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.DocumentFragment")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/domimplementation/createdocument/index.md b/files/pt-br/web/api/domimplementation/createdocument/index.md index 3a96bfc7970355..2a9344c71c7627 100644 --- a/files/pt-br/web/api/domimplementation/createdocument/index.md +++ b/files/pt-br/web/api/domimplementation/createdocument/index.md @@ -25,24 +25,24 @@ doc = document.implementation.createDocument(namespaceURI, qualifiedNameStr, doc ## Example ```js -var doc = document.implementation.createDocument ('https://www.w3.org/1999/xhtml', 'html', null); -var body = document.createElementNS('https://www.w3.org/1999/xhtml', 'body'); -body.setAttribute('id', 'abc'); +var doc = document.implementation.createDocument( + "https://www.w3.org/1999/xhtml", + "html", + null, +); +var body = document.createElementNS("https://www.w3.org/1999/xhtml", "body"); +body.setAttribute("id", "abc"); doc.documentElement.appendChild(body); -alert(doc.getElementById('abc')); // [object HTMLBodyElement] +alert(doc.getElementById("abc")); // [object HTMLBodyElement] ``` -## Specifications +## Especificações -| Specification | Status | Comment | -| -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| {{SpecName('DOM WHATWG', '#dom-domimplementation-createdocument', 'DOMImplementation.createDocument')}} | {{Spec2('DOM WHATWG')}} | Modified the return type of `createDocument()` from {{domxref("Document")}} to {{domxref("XMLDocument")}}. The third argument of `createDocument()`, _doctype_, is now optional and default to `null`. | -| {{SpecName('DOM3 Core', 'core.html#Level-2-Core-DOM-createDocument', 'DOMImplementation.createDocument')}} | {{Spec2('DOM3 Core')}} | No change from {{SpecName("DOM2 Core")}} | -| {{SpecName('DOM2 Core', 'core.html#Level-2-Core-DOM-createDocument', 'DOMImplementation.createDocument')}} | {{Spec2('DOM2 Core')}} | Initial definition. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.DOMImplementation.createDocument")}} +{{Compat}} ## See also diff --git a/files/pt-br/web/api/domimplementation/index.md b/files/pt-br/web/api/domimplementation/index.md index 92b727d491a42a..71efa00e0e8281 100644 --- a/files/pt-br/web/api/domimplementation/index.md +++ b/files/pt-br/web/api/domimplementation/index.md @@ -24,18 +24,13 @@ _No inherited method._ - {{domxref("DOMImplementation.hasFeature()")}} - : Returns a {{domxref("Boolean")}} indicating if a given feature is supported or not. This function is unreliable and kept for compatibility purpose alone: except for SVG-related queries, it always returns `true`. Old browsers are very inconsistent in their behavior. -## Specifications +## Especificações -| Specification | Status | Comment | -| -------------------------------------------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| {{SpecName('DOM WHATWG', '#domimplementation', 'DOMImplementation')}} | {{Spec2('DOM WHATWG')}} | Removed the `getFeature()` method. Added the `createHTMLDocument()` method. Modified the return type of `createDocument()` from {{domxref("Document")}} to {{domxref("XMLDocument")}}. | -| {{SpecName('DOM3 Core', 'core.html#ID-102161490', 'DOMImplementation')}} | {{Spec2('DOM3 Core')}} | Added the `getFeature()` method (never implemented by any user agent). | -| {{SpecName('DOM2 Core', 'core.html#ID-102161490', 'DOMImplementation')}} | {{Spec2('DOM2 Core')}} | Added the `createDocument()` and `createDocumentType()` methods. | -| {{SpecName('DOM1', 'level-one-core.html#ID-102161490', 'DOMImplementation')}} | {{Spec2('DOM1')}} | Initial definition. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.DOMImplementation")}} +{{Compat}} ## See also diff --git a/files/pt-br/web/api/domstringlist/index.md b/files/pt-br/web/api/domstringlist/index.md index 4c5000b3ceb73f..36d69c8739a8cc 100644 --- a/files/pt-br/web/api/domstringlist/index.md +++ b/files/pt-br/web/api/domstringlist/index.md @@ -21,6 +21,8 @@ Um tipo retornado por algumas APIs, que contém uma lista de [DOMString](/En/DOM ## Especificações -| Especificação | Status | Comentário | -| ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | --------------------- | -| {{SpecName("HTML WHATWG", "common-dom-interfaces.html#the-domstringlist-interface", "DOMStringList")}} | {{Spec2("HTML WHATWG")}} | Especificação Inicial | +{{Specifications}} + +## Compatibilidade com navegadores + +{{Compat}} diff --git a/files/pt-br/web/api/element/animate/index.md b/files/pt-br/web/api/element/animate/index.md index 06753ee6edfc98..bea3d093293245 100644 --- a/files/pt-br/web/api/element/animate/index.md +++ b/files/pt-br/web/api/element/animate/index.md @@ -20,7 +20,9 @@ var animation = element.animate(keyframes, options); - `keyframes` - : An [Object formatted to represent a set of keyframes](/pt-BR/docs/Web/API/Web_Animations_API/Keyframe_Formats). - `opções` + - : Ou um inteiro representando a duração da animação (em milisegundos), ou um objeto contendo uma ou mais propriedades de tempo: + - `id {{optional_inline}}` - : Um propriedade única á animate(): uma `DOMString` com a qual a animação é referenciada. @@ -60,26 +62,27 @@ Na demonstração [Down the Rabbit Hole (with the Web Animation API)](https://co Note o array de quadros-chave passado e também o bloco de opções de temporização. ```js -document.getElementById("tunnel").animate([ - // keyframes - { transform: 'translateY(0px)' }, - { transform: 'translateY(-300px)' } -], { - // timing options - duration: 1000, - iterations: Infinity -}); +document.getElementById("tunnel").animate( + [ + // keyframes + { transform: "translateY(0px)" }, + { transform: "translateY(-300px)" }, + ], + { + // timing options + duration: 1000, + iterations: Infinity, + }, +); ``` ## Especificações -| Specification | Status | Comment | -| ------------------------------------------------------------------------------------------------ | ------------------------------------ | ------------------ | -| {{SpecName('Web Animations', '#the-animatable-interface', 'animate()' )}} | {{Spec2('Web Animations')}} | Initial definition | +{{Specifications}} -## Compatibildade entre Navegadores +## Compatibilidade com navegadores -{{Compat("api.Element.animate")}} +{{Compat}} ## Veja Também diff --git a/files/pt-br/web/api/element/attributes/index.md b/files/pt-br/web/api/element/attributes/index.md index 2a427f7ea07caf..751a7b39800dce 100644 --- a/files/pt-br/web/api/element/attributes/index.md +++ b/files/pt-br/web/api/element/attributes/index.md @@ -29,57 +29,53 @@ Indexadores numéricos são úteis para percorrer através de todos os atributos O exemplo a seguir percorre através dos nós dos atributos do elemento no documento que tenha o id de "p1", e imprime o valor de cada atributo. ```html - + - - - Exemplo com atributos - - - - -

Paragrafo de exemplo

- -

- - -

-
- + + Exemplo com atributos + + + + +

Paragrafo de exemplo

+
+

+ + +

+
+ ``` ## Especificações -| Especificação | Status | Comentário | -| ---------------------------------------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------- | -| {{SpecName('DOM WHATWG', '#dom-element-attributes', 'Element.attributes')}} | {{Spec2('DOM WHATWG')}} | Da {{SpecName('DOM3 Core')}}, movido de {{domxref("Node")}} para {{domxref("Element")}} | -| {{SpecName('DOM3 Core', 'core.html#ID-84CF096', 'Element.attributes')}} | {{Spec2('DOM3 Core')}} | Nenhuma alteração a partir da {{SpecName('DOM2 Core')}} | -| {{SpecName('DOM2 Core', 'core.html#ID-84CF096', 'Element.attributes')}} | {{Spec2('DOM2 Core')}} | Nenhuma alteração a partir da {{SpecName('DOM1')}} | -| {{SpecName('DOM1', 'level-one-core.html#ID-84CF096', 'Element.attributes')}} | {{Spec2('DOM1')}} | Definição inicial. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.attributes")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/blur_event/index.md b/files/pt-br/web/api/element/blur_event/index.md index 181b5d52141598..c39a51600b227c 100644 --- a/files/pt-br/web/api/element/blur_event/index.md +++ b/files/pt-br/web/api/element/blur_event/index.md @@ -25,12 +25,12 @@ O evento `blur` é acionado quando um elemento perde foco. A diferença principa ## Propriedades -| Property | Type | Description | -| ---------------------------------------- | -------------------------------------------------- | ------------------------------------------ | +| Property | Type | Description | +| ---------------------------------- | ---------------------------------------- | ------------------------------------------ | | `target` {{readonlyInline}} | {{domxref("EventTarget")}} | Event target (DOM element) | -| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | -| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | -| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | +| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | +| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | +| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | | `relatedTarget` {{readonlyInline}} | {{domxref("EventTarget")}} (DOM element) | null | ## Delegação do evento @@ -41,8 +41,8 @@ Existem duas maneiras de implementar a delegação de eventos para este evento: ```html
- - + +
``` @@ -50,19 +50,31 @@ Existem duas maneiras de implementar a delegação de eventos para este evento: ```js var form = document.getElementById("form"); -form.addEventListener("focus", function( event ) { - event.target.style.background = "pink"; -}, true); -form.addEventListener("blur", function( event ) { - event.target.style.background = ""; -}, true); +form.addEventListener( + "focus", + function (event) { + event.target.style.background = "pink"; + }, + true, +); +form.addEventListener( + "blur", + function (event) { + event.target.style.background = ""; + }, + true, +); ``` {{EmbedLiveSample('Event_delegation')}} +## Especificações + +{{Specifications}} + ## Compatibilidade com navegadores -{{Compat("api.Element.blur_event")}} +{{Compat}} ## Eventos relacionados diff --git a/files/pt-br/web/api/element/childelementcount/index.md b/files/pt-br/web/api/element/childelementcount/index.md index c77f6aadaa9e70..d72860c8d0fc02 100644 --- a/files/pt-br/web/api/element/childelementcount/index.md +++ b/files/pt-br/web/api/element/childelementcount/index.md @@ -24,7 +24,7 @@ var count = node.childElementCount; ## Exemplo ```js -var foo = document.getElementById('foo'); +var foo = document.getElementById("foo"); if (foo.childElementCount > 0) { // Faz algo } @@ -35,18 +35,23 @@ if (foo.childElementCount > 0) { Essa propriedade não é suportada em versões anteriores ao IE9. Já no IE9 ou Safari, não será suportada somente por Objetos de `Document` e `DocumentFragment`. ```js -;(function(constructor) { - if (constructor && - constructor.prototype && - constructor.prototype.childElementCount == null) { - Object.defineProperty(constructor.prototype, 'childElementCount', { - get: function() { - var i = 0, count = 0, node, nodes = this.childNodes; - while (node = nodes[i++]) { +(function (constructor) { + if ( + constructor && + constructor.prototype && + constructor.prototype.childElementCount == null + ) { + Object.defineProperty(constructor.prototype, "childElementCount", { + get: function () { + var i = 0, + count = 0, + node, + nodes = this.childNodes; + while ((node = nodes[i++])) { if (node.nodeType === 1) count++; } return count; - } + }, }); } })(window.Node || window.Element); @@ -54,10 +59,7 @@ Essa propriedade não é suportada em versões anteriores ao IE9. Já no IE9 ou ## Especificações -| Especificações | Status | Comentários | -| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| {{SpecName('DOM WHATWG', '#dom-parentnode-childelementcount', 'ParentNode.childElementCount')}} | {{Spec2('DOM WHATWG')}} | Divide a interface `ElementTraversal` entre {{domxref("ChildNode")}} e `ParentNode`. Esse método é definido ao final. {{domxref("Document")}} e {{domxref("DocumentFragment")}} implementam essas novas interfaces. | -| {{SpecName('Element Traversal', '#attribute-childElementCount', 'ElementTraversal.childElementCount')}} | {{Spec2('Element Traversal')}} | Adicionada sua definição inicial à interface pura do `ElementTraversal` e use-a em {{domxref("Element")}}. | +{{Specifications}} ## Compatibilidade com navegadores diff --git a/files/pt-br/web/api/element/classlist/index.md b/files/pt-br/web/api/element/classlist/index.md index cf32d9002a75f9..05bde9b81e6c66 100644 --- a/files/pt-br/web/api/element/classlist/index.md +++ b/files/pt-br/web/api/element/classlist/index.md @@ -42,12 +42,12 @@ div.classList.add("anotherclass"); div.classList.toggle("visible"); // adicionar/remover, dependendo do teste condicional, i menos de 10 -div.classList.toggle("visible", i < 10 ); +div.classList.toggle("visible", i < 10); alert(div.classList.contains("foo")); // adicionar ou remover várias classes -div.classList.add("foo","bar"); +div.classList.add("foo", "bar"); div.classList.remove("foo", "bar"); ``` @@ -55,15 +55,11 @@ div.classList.remove("foo", "bar"); ## Especificações -| Especificações | Status | Comentário | -| ---------------------------------------------------------------------------------------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------- | -| {{SpecName("HTML WHATWG", "dom.html#dom-classlist", "Element.classList")}} | {{Spec2("HTML WHATWG")}} | Observe dentro da especificação HTML relacionada ao [`class`](/pt-BR/docs/Web/HTML/Global_attributes#class) attribute. | -| {{SpecName("DOM WHATWG", "#dom-element-classlist", "Element.classList")}} | {{Spec2("DOM WHATWG")}} | Definição inicial | -| {{SpecName("DOM4", "#dom-element-classlist", "Element.classList")}} | {{Spec2("DOM4")}} | | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.classList")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/classname/index.md b/files/pt-br/web/api/element/classname/index.md index 4b5fea13996c68..090b24ceb612a7 100644 --- a/files/pt-br/web/api/element/classname/index.md +++ b/files/pt-br/web/api/element/classname/index.md @@ -35,15 +35,11 @@ if (element.className === "fixed") { ## Especificações -| Specification | Status | Comment | -| ------------------------------------------------------------------------------------------------ | -------------------------------- | ----------------- | -| {{SpecName("DOM WHATWG", "#dom-element-classname", "element.className")}} | {{Spec2("DOM WHATWG")}} | | -| {{SpecName("DOM4", "#dom-element-classname", "element.className")}} | {{Spec2("DOM4")}} | | -| {{SpecName("DOM2 HTML", "html.html#ID-95362176", "element.className")}} | {{Spec2("DOM2 HTML")}} | Definição inicial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.className")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/click_event/index.md b/files/pt-br/web/api/element/click_event/index.md index 332e5f470d4353..384d4e1e628062 100644 --- a/files/pt-br/web/api/element/click_event/index.md +++ b/files/pt-br/web/api/element/click_event/index.md @@ -22,27 +22,27 @@ O evento `click` event é disparado quando o botão de um dispositivo apontador ## Propriedades -| Property | Type | Description | -| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `target` {{readonlyInline}} | [`EventTarget`](/pt-BR/docs/Web/API/EventTarget) | O alvo do evento (o mais alto na arvore de DOM). | -| `type` {{readonlyInline}} | [`DOMString`](/pt-BR/docs/Web/API/DOMString) | Tipo do evento. | -| `bubbles` {{readonlyInline}} | [`Boolean`](/pt-BR/docs/Web/API/Boolean) | Se o evento "bubbles" naturalmente ou não. | -| `cancelable` {{readonlyInline}} | [`Boolean`](/pt-BR/docs/Web/API/Boolean) | Se o evento é cancelável ou não | -| `view` {{readonlyInline}} | [`WindowProxy`](/pt-BR/docs/Web/API/WindowProxy) | [`document.defaultView`](/pt-BR/docs/Web/API/Document/defaultView) (`window` do documento) | -| `detail` {{readonlyInline}} | `long` (`float`) | Um contador de cliques consecutivos que ocorrem em um curto espaço de tempo, incrementado em 1. | -| `currentTarget` {{readonlyInline}} | EventTarget | O node que contem o eventListener. | -| `relatedTarget` {{readonlyInline}} | EventTarget | Para eventos `mouseover`, `mouseout`, `mouseenter` e `mouseleave`: o alvo do evento complementar (o `mouseleave` no caso de um evento `mouseenter` ). `null` , se falso. | -| `screenX` {{readonlyInline}} | long | A coordenada X do ponteiro do mouse na tela. | -| `screenY` {{readonlyInline}} | long | A coordenada Y do ponteiro do mouse na tela. | -| `clientX` {{readonlyInline}} | long | A coordenada X do ponteiro do mouse no DOM atual. | -| `clientY` {{readonlyInline}} | long | A coordenada Y do ponteiro do mouse no DOM atual. | -| `button` {{readonlyInline}} | unsigned short | The button number that was pressed when the mouse event was fired: Left button=0, middle button=1 (if present), right button=2. For mice configured for left handed use in which the button actions are reversed the values are instead read from right to left. | -| `buttons` {{readonlyInline}} | unsigned short | The buttons being pressed when the mouse event was fired: Left button=1, Right button=2, Middle (wheel) button=4, 4th button (typically, "Browser Back" button)=8, 5th button (typically, "Browser Forward" button)=16. If two or more buttons are pressed, returns the logical sum of the values. E.g., if Left button and Right button are pressed, returns 3 (=1 \| 2). [More info](/pt-BR/docs/Web/API/MouseEvent). | -| `mozPressure` {{readonlyInline}} | float | The amount of pressure applied to a touch or tabdevice when generating the event; this value ranges between 0.0 (minimum pressure) and 1.0 (maximum pressure). | -| `ctrlKey` {{readonlyInline}} | boolean | `true` if the control key was down when the event was fired. `false` otherwise. | -| `shiftKey` {{readonlyInline}} | boolean | `true` if the shift key was down when the event was fired. `false` otherwise. | -| `altKey` {{readonlyInline}} | boolean | `true` if the alt key was down when the event was fired. `false` otherwise. | -| `metaKey` {{readonlyInline}} | boolean | `true` if the meta key was down when the event was fired. `false` otherwise. | +| Property | Type | Description | +| ---------------------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `target` {{readonlyInline}} | [`EventTarget`](/pt-BR/docs/Web/API/EventTarget) | O alvo do evento (o mais alto na arvore de DOM). | +| `type` {{readonlyInline}} | [`DOMString`](/pt-BR/docs/Web/API/DOMString) | Tipo do evento. | +| `bubbles` {{readonlyInline}} | [`Boolean`](/pt-BR/docs/Web/API/Boolean) | Se o evento "bubbles" naturalmente ou não. | +| `cancelable` {{readonlyInline}} | [`Boolean`](/pt-BR/docs/Web/API/Boolean) | Se o evento é cancelável ou não | +| `view` {{readonlyInline}} | [`WindowProxy`](/pt-BR/docs/Web/API/WindowProxy) | [`document.defaultView`](/pt-BR/docs/Web/API/Document/defaultView) (`window` do documento) | +| `detail` {{readonlyInline}} | `long` (`float`) | Um contador de cliques consecutivos que ocorrem em um curto espaço de tempo, incrementado em 1. | +| `currentTarget` {{readonlyInline}} | EventTarget | O node que contem o eventListener. | +| `relatedTarget` {{readonlyInline}} | EventTarget | Para eventos `mouseover`, `mouseout`, `mouseenter` e `mouseleave`: o alvo do evento complementar (o `mouseleave` no caso de um evento `mouseenter` ). `null` , se falso. | +| `screenX` {{readonlyInline}} | long | A coordenada X do ponteiro do mouse na tela. | +| `screenY` {{readonlyInline}} | long | A coordenada Y do ponteiro do mouse na tela. | +| `clientX` {{readonlyInline}} | long | A coordenada X do ponteiro do mouse no DOM atual. | +| `clientY` {{readonlyInline}} | long | A coordenada Y do ponteiro do mouse no DOM atual. | +| `button` {{readonlyInline}} | unsigned short | The button number that was pressed when the mouse event was fired: Left button=0, middle button=1 (if present), right button=2. For mice configured for left handed use in which the button actions are reversed the values are instead read from right to left. | +| `buttons` {{readonlyInline}} | unsigned short | The buttons being pressed when the mouse event was fired: Left button=1, Right button=2, Middle (wheel) button=4, 4th button (typically, "Browser Back" button)=8, 5th button (typically, "Browser Forward" button)=16. If two or more buttons are pressed, returns the logical sum of the values. E.g., if Left button and Right button are pressed, returns 3 (=1 \| 2). [More info](/pt-BR/docs/Web/API/MouseEvent). | +| `mozPressure` {{readonlyInline}} | float | The amount of pressure applied to a touch or tabdevice when generating the event; this value ranges between 0.0 (minimum pressure) and 1.0 (maximum pressure). | +| `ctrlKey` {{readonlyInline}} | boolean | `true` if the control key was down when the event was fired. `false` otherwise. | +| `shiftKey` {{readonlyInline}} | boolean | `true` if the shift key was down when the event was fired. `false` otherwise. | +| `altKey` {{readonlyInline}} | boolean | `true` if the alt key was down when the event was fired. `false` otherwise. | +| `metaKey` {{readonlyInline}} | boolean | `true` if the meta key was down when the event was fired. `false` otherwise. | ## Exemplo diff --git a/files/pt-br/web/api/element/closest/index.md b/files/pt-br/web/api/element/closest/index.md index 5aadd1b93b1358..ec0c20326e2d50 100644 --- a/files/pt-br/web/api/element/closest/index.md +++ b/files/pt-br/web/api/element/closest/index.md @@ -30,8 +30,10 @@ var elt = element.closest(selectors); ```html
-
Esta é a div-01 -
Esta é a div-02 +
+ Esta é a div-01 +
+ Esta é a div-02
Esta é a div-03
@@ -39,7 +41,7 @@ var elt = element.closest(selectors); ``` ```js -var el = document.getElementById('div-03'); +var el = document.getElementById("div-03"); var r1 = el.closest("#div-02"); // retorna o elemento com id=div-02 @@ -60,48 +62,46 @@ Para navegadores que não suportam `Element.closest()`, mas possuem suporte para ```js if (!Element.prototype.matches) - Element.prototype.matches = Element.prototype.msMatchesSelector || - Element.prototype.webkitMatchesSelector; + Element.prototype.matches = + Element.prototype.msMatchesSelector || + Element.prototype.webkitMatchesSelector; if (!Element.prototype.closest) - Element.prototype.closest = function(s) { - var el = this; - if (!document.documentElement.contains(el)) return null; - do { - if (el.matches(s)) return el; - el = el.parentElement; - } while (el !== null); - return null; - }; + Element.prototype.closest = function (s) { + var el = this; + if (!document.documentElement.contains(el)) return null; + do { + if (el.matches(s)) return el; + el = el.parentElement; + } while (el !== null); + return null; + }; ``` Contudo, se você de fato precisa dar suporte ao IE 8, você pode usar o polyfill abaixo, o qual é lento mas eficaz. Além disso, ele só garante suporte a seletores CSS 2.1 no IE 8 e ainda pode causar picos de lentidão em websites em produção. ```js if (window.Element && !Element.prototype.closest) { - Element.prototype.closest = - function(s) { - var matches = (this.document || this.ownerDocument).querySelectorAll(s), - i, - el = this; - do { - i = matches.length; - while (--i >= 0 && matches.item(i) !== el) {}; - } while ((i < 0) && (el = el.parentElement)); - return el; - }; + Element.prototype.closest = function (s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i, + el = this; + do { + i = matches.length; + while (--i >= 0 && matches.item(i) !== el) {} + } while (i < 0 && (el = el.parentElement)); + return el; + }; } ``` ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------------------ | -------------------------------- | ------------------ | -| {{SpecName('DOM WHATWG', '#dom-element-closest', 'Element.closest()')}} | {{Spec2('DOM WHATWG')}} | Definição inicial. | +{{Specifications}} -## Compatibilidade em navegadores +## Compatibilidade com navegadores -{{Compat("api.Element.closest")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/contextmenu_event/index.md b/files/pt-br/web/api/element/contextmenu_event/index.md index 927bd6dd2efdfa..690d5485b15627 100644 --- a/files/pt-br/web/api/element/contextmenu_event/index.md +++ b/files/pt-br/web/api/element/contextmenu_event/index.md @@ -20,17 +20,25 @@ window.oncontextmenu = funcRef; Os exemplos abaixo irão desabilitar o clique com botão direito na página: ```js -document.oncontextmenu = function () { // Usa o document ao invés de window para compatibilidade com o IE8 - return false; +document.oncontextmenu = function () { + // Usa o document ao invés de window para compatibilidade com o IE8 + return false; }; -window.addEventListener('contextmenu', function (e) { // Não compatível com IE < 9 +window.addEventListener( + "contextmenu", + function (e) { + // Não compatível com IE < 9 e.preventDefault(); -}, false); + }, + false, +); ``` ## Especificações -| Especificação | Status | Comentário | -| ---------------------------------------------------------------------------------------------------------------- | -------------------------------- | ---------- | -| {{SpecName('HTML WHATWG','webappapis.html#handler-oncontextmenu','oncontextmenu')}} | {{Spec2('HTML WHATWG')}} | | +{{Specifications}} + +## Compatibilidade com navegadores + +{{Compat}} diff --git a/files/pt-br/web/api/element/focus_event/index.md b/files/pt-br/web/api/element/focus_event/index.md index 27ec1a614f1571..1d2a888c7cd323 100644 --- a/files/pt-br/web/api/element/focus_event/index.md +++ b/files/pt-br/web/api/element/focus_event/index.md @@ -25,12 +25,12 @@ O evento `focus` é acionado assim que um elemento recebe um foco. O grande dife ## Propriedades -| Property | Type | Description | -| ---------------------------------------- | -------------------------------------------------- | ------------------------------------------ | +| Property | Type | Description | +| ---------------------------------- | ---------------------------------------- | ------------------------------------------ | | `target` {{readonlyInline}} | {{domxref("EventTarget")}} | Event target (DOM element) | -| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | -| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | -| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | +| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | +| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | +| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | | `relatedTarget` {{readonlyInline}} | {{domxref("EventTarget")}} (DOM element) | null | ## Eventos Delegados @@ -41,9 +41,13 @@ Existem 2 maneiras diferentes de implementações delegados a partir de um event (Exemplo de codigo do evento [blur (event)](/pt-BR/docs/Web/Events/blur)) +## Especificações + +{{Specifications}} + ## Compatibilidade com navegadores -{{Compat("api.Element.focus_event")}} +{{Compat}} ## Eventos Relacionais diff --git a/files/pt-br/web/api/element/focusin_event/index.md b/files/pt-br/web/api/element/focusin_event/index.md index 817eabd68bcbee..3709683f953e24 100644 --- a/files/pt-br/web/api/element/focusin_event/index.md +++ b/files/pt-br/web/api/element/focusin_event/index.md @@ -23,17 +23,21 @@ O evento `focusin` é acionado no momento em que o elemento receba o foco. A gra ## Propriedades -| Property | Type | Description | -| ---------------------------------------- | -------------------------------------------------- | ------------------------------------------ | +| Property | Type | Description | +| ---------------------------------- | ---------------------------------------- | ------------------------------------------ | | `target` {{readonlyInline}} | {{domxref("EventTarget")}} | Event target losing focus. | -| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | -| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | -| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | +| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | +| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | +| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | | `relatedTarget` {{readonlyInline}} | {{domxref("EventTarget")}} (DOM element) | Event target receiving focus. | +## Especificações + +{{Specifications}} + ## Compatibilidade com navegadores -{{Compat("api.Element.focusin_event")}} +{{Compat}} ## Eventos Relacionais diff --git a/files/pt-br/web/api/element/focusout_event/index.md b/files/pt-br/web/api/element/focusout_event/index.md index 1da54d44611941..c9bef5d3da0860 100644 --- a/files/pt-br/web/api/element/focusout_event/index.md +++ b/files/pt-br/web/api/element/focusout_event/index.md @@ -21,19 +21,13 @@ O evento `focusout` é acionado assim que o elemento perde o foco. A principal d - Ação Padrão - : Nenhuma. -## Propriedades +## Especificações -| Property | Type | Description | -| ---------------------------------------- | -------------------------------------------------- | ------------------------------------------ | -| `target` {{readonlyInline}} | {{domxref("EventTarget")}} | Event target losing focus. | -| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | -| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. | -| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. | -| `relatedTarget` {{readonlyInline}} | {{domxref("EventTarget")}} (DOM element) | Event target receiving focus. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.focusout_event")}} +{{Compat}} ## Eventos Relcionados diff --git a/files/pt-br/web/api/element/getboundingclientrect/index.md b/files/pt-br/web/api/element/getboundingclientrect/index.md index 9783617c08c27c..68f748fc114c18 100644 --- a/files/pt-br/web/api/element/getboundingclientrect/index.md +++ b/files/pt-br/web/api/element/getboundingclientrect/index.md @@ -29,11 +29,17 @@ Scripts que requerem uma alta compatibilidade cross-browser podem usar `window.p ```js // Para o scrollX -(((t = document.documentElement) || (t = document.body.parentNode)) - && typeof t.ScrollLeft == 'number' ? t : document.body).ScrollLeft -// Para o scrollY -(((t = document.documentElement) || (t = document.body.parentNode)) - && typeof t.ScrollTop == 'number' ? t : document.body).ScrollTop +(((t = document.documentElement) || (t = document.body.parentNode)) && +typeof t.ScrollLeft == "number" + ? t + : document.body +).ScrollLeft( + // Para o scrollY + ((t = document.documentElement) || (t = document.body.parentNode)) && + typeof t.ScrollTop == "number" + ? t + : document.body, +).ScrollTop; ``` ## Exemplo @@ -43,21 +49,13 @@ Scripts que requerem uma alta compatibilidade cross-browser podem usar `window.p var rect = obj.getBoundingClientRect(); ``` -## Especificaçōes +## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------- | ----------------- | -| {{SpecName("CSSOM View", "#dom-element-getboundingclientrect", "Element.getBoundingClientRect()")}} | {{Spec2("CSSOM View")}} | Definiçāo Inicial | +{{Specifications}} -### Notas +## Compatibilidade com navegadores -`getBoundingClientRect()` foi primeiramente introduzida no modelo de objeto MS IE DHTML. - -O valor de retorno de `getBoundingClientRect()` é [frozen](/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze). - -## Compatibilidade - -{{Compat("api.Element.getBoundingClientRect")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/getelementsbyclassname/index.md b/files/pt-br/web/api/element/getelementsbyclassname/index.md index d46fb3bc540a8f..9879edf40fd57c 100644 --- a/files/pt-br/web/api/element/getelementsbyclassname/index.md +++ b/files/pt-br/web/api/element/getelementsbyclassname/index.md @@ -39,13 +39,13 @@ O oposto disso também acontece; os elementos que não satisfazerem mais as clas Para procurarmos elementos que incluem uma classe específica, nós apenas informamos o nome da classe ao chamar `getElementsByClassName()`: ```js -element.getElementsByClassName('test'); +element.getElementsByClassName("test"); ``` Esse exemplo retorna todos os elementos que possuem a classe `test`, e que também são filhos do elemento que possui o `id` com valor `main`: ```js -document.getElementById('main').getElementsByClassName('test'); +document.getElementById("main").getElementsByClassName("test"); ``` ### Usando várias classes @@ -53,7 +53,7 @@ document.getElementById('main').getElementsByClassName('test'); Para retornar elementos que incluem as classes `red` and `test`: ```js -element.getElementsByClassName('red test'); +element.getElementsByClassName("red test"); ``` ### Examinando os resultados @@ -61,22 +61,22 @@ element.getElementsByClassName('red test'); You can use either the {{domxref("HTMLCollection.item", "item()")}} method on the returned `HTMLCollection` or standard array syntax to examine individual elements in the collection. However **the following code will not work** as one might expect because `"matches"` will change as soon as any `"colorbox"` class is removed. ```js -var matches = element.getElementsByClassName('colorbox'); +var matches = element.getElementsByClassName("colorbox"); -for (var i=0; i 0) { - matches.item(0).classList.add('hueframe'); - matches[0].classList.remove('colorbox'); + matches.item(0).classList.add("hueframe"); + matches[0].classList.remove("colorbox"); } ``` @@ -87,18 +87,19 @@ This code finds descendant elements with the `"colorbox"` class, adds the class We can also use methods of {{jsxref("Array.prototype")}} on any {{ domxref("HTMLCollection") }} by passing the {{domxref("HTMLCollection")}} as the method's `this` value. Here we'll find all {{HTMLElement("div")}} elements that have a class of `test`: ```js -var testElements = document.getElementsByClassName('test'); -var testDivs = Array.prototype.filter.call(testElements, function(testElement) { - return testElement.nodeName === 'DIV'; -}); +var testElements = document.getElementsByClassName("test"); +var testDivs = Array.prototype.filter.call( + testElements, + function (testElement) { + return testElement.nodeName === "DIV"; + }, +); ``` -## Specifications +## Especificações -| Specification | Status | Comment | -| ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | -| {{SpecName('DOM WHATWG', '#dom-element-getelementsbyclassname', 'Element.getElementsByClassName()')}} | {{Spec2('DOM WHATWG')}} | Initial definition | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.getElementsByClassName")}} +{{Compat}} diff --git a/files/pt-br/web/api/element/id/index.md b/files/pt-br/web/api/element/id/index.md index 9419664c240c52..58b729ea98a26c 100644 --- a/files/pt-br/web/api/element/id/index.md +++ b/files/pt-br/web/api/element/id/index.md @@ -22,15 +22,11 @@ element.id = idStr; // Insere o id ## Especificações -| Especificação | Status | Comentário | -| -------------------------------------------------------------------------------- | -------------------------------- | ----------------------------------------------------- | -| {{SpecName('DOM WHATWG', '#dom-element-id', 'id')}} | {{Spec2('DOM WHATWG')}} | Sem alteração desde {{SpecName('DOM2 HTML')}}. | -| {{SpecName('DOM2 HTML', 'html.html#ID-63534901', 'id')}} | {{Spec2('DOM2 HTML')}} | Sem alteração desde {{SpecName('DOM1')}}. | -| {{SpecName('DOM1', 'level-one-html.html#ID-63534901', 'id')}} | {{Spec2('DOM1')}} | Definição inicial. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.id")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/index.md b/files/pt-br/web/api/element/index.md index e2924ef51f1a25..d709428ca11818 100644 --- a/files/pt-br/web/api/element/index.md +++ b/files/pt-br/web/api/element/index.md @@ -158,23 +158,8 @@ _Herda métodos de seus parentes {{domxref("Node")}}, e seu proprío parente, {{ ## Especificações -| Specification | Status | Comment | -| ------------------------------------------------------------------------------------------------------------ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| {{SpecName("Web Animations", '', '')}} | {{Spec2("Web Animations")}} | Adicionado o método `getAnimationPlayers()`. | -| {{SpecName('Undo Manager', '', 'Element')}} | {{Spec2('Undo Manager')}} | Adicionadas as propriedades `undoScope` e `undoManager`. | -| {{SpecName('Pointer Events', '#extensions-to-the-element-interface', 'Element')}} | {{Spec2('Pointer Events')}} | Adicionados os seguintes manipuladores de evento: `ongotpointercapture` e `onlostpointercapture`. Adicionados os seguintes métodos: `setPointerCapture()` e `releasePointerCapture()`. | -| {{SpecName('Selectors API Level 2', '#interface-definitions', 'Element')}} | {{Spec2('Selectors API Level 2')}} | Adicionados os seguintes métodos: `matches()` (implementado como `mozMatchesSelector()`), `find()`, `findAll()`. | -| {{SpecName('Selectors API Level 1', '#interface-definitions', 'Element')}} | {{Spec2('Selectors API Level 1')}} | Adicionados os seguintes métodos: `querySelector()` e `querySelectorAll()`. | -| {{SpecName('Pointer Lock', 'index.html#element-interface', 'Element')}} | {{Spec2('Pointer Lock')}} | Adicionado o método `requestPointerLock()`. | -| {{SpecName('Fullscreen', '#api', 'Element')}} | {{Spec2('Fullscreen')}} | Adicionado o método `requestFullscreen()`. | -| {{SpecName('DOM Parsing', '#extensions-to-the-element-interface', 'Element')}} | {{Spec2('DOM Parsing')}} | Adicionadas as seguintes propriedades: `innerHTML`, e `outerHTML`. Adicionado o seguinte método: `insertAdjacentHTML()`. | -| {{SpecName('CSSOM View', '#extensions-to-the-element-interface', 'Element')}} | {{Spec2('CSSOM View')}} | Adicionadas as seguintes propriedades: `scrollTop`, `scrollLeft`, `scrollWidth`, `scrollHeight`, `clientTop`, `clientLeft`, `clientWidth`, e `clientHeight`. Adicionados os seguintes métodos: `getClientRects()`, `getBoundingClientRect()`, e `scrollIntoView()`. | -| {{SpecName('Element Traversal', '#ecmascript-bindings', 'Element')}} | {{Spec2('Element Traversal')}} | Adicionada herança da interface {{domxref("ElementTraversal")}}. | -| {{SpecName('DOM WHATWG', '#interface-element', 'Element')}} | {{Spec2('DOM WHATWG')}} | Removidos os seguintes métodos: `closest()`, `setIdAttribute()`, `setIdAttributeNS()`, e `setIdAttributeNode()`. Removida a propriedade `schemaTypeInfo`. Modificado o valor de retorno de `getElementsByTag()` e `getElementsByTagNS()`. Movida `hasAttributes()` da interface `Node` para esta. | -| {{SpecName('DOM3 Core', 'core.html#ID-745549614', 'Element')}} | {{Spec2('DOM3 Core')}} | Adicionados os seguintes métodos: `setIdAttribute()`, `setIdAttributeNS()`, e `setIdAttributeNode()`. Estes métodos nunca foram implementados e foram removidos em especificações posteriores. Adicionada a propriedade `schemaTypeInfo`. Esta propriedade nunca foi implementada e foi removida em especificações posteriores. | -| {{SpecName('DOM2 Core', 'core.html#ID-745549614', 'Element')}} | {{Spec2('DOM2 Core')}} | O método `normalize()` foi movido para {{domxref("Node")}}. | -| {{SpecName('DOM1', 'level-one-core.html#ID-745549614', 'Element')}} | {{Spec2('DOM1')}} | Definição inicial. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element")}} +{{Compat}} diff --git a/files/pt-br/web/api/element/innerhtml/index.md b/files/pt-br/web/api/element/innerhtml/index.md index 9bce02b76654d0..a7492c16f27ad2 100644 --- a/files/pt-br/web/api/element/innerhtml/index.md +++ b/files/pt-br/web/api/element/innerhtml/index.md @@ -92,7 +92,9 @@ A propriedade `innerHTML` de vários tipos de elementos — incluindo {{HTMLElem ```js // Copie e cole este código, em uma única linha, na barra de endereços -javascript:"
"+document.documentElement.innerHTML.replace(/";
+javascript: "
" +
+  document.documentElement.innerHTML.replace(/";
 ```
 
 Essa propriedade foi implementada inicialmente pelos navegadores web, e então especificada pela WHATWG e W3C no HTML5. Implementações antigas talvez não tenham implementado-a exatamente da mesma forma. Por exemplo, quando um texto é inserido em uma caixa de texto, o Internet Explorer muda o valor do atributo innerHTML dessa entrada, mas os navegadores Gecko não.
@@ -124,11 +126,13 @@ el.innerHTML = name; // exibe uma caixa de alerta
 
 Por essa razão, recomenda-se que você não use o `innerHTML` quando estiver inserindo texto puro; como alternativa, utilize {{domxref("node.textContent")}}. Isso não interpreta o conteúdo passado como HTML, mas em vez disso, insere-o como texto puro.
 
-## Especificação
+## Especificações
 
-| Especificação                                                                                        | Estado                               | Comentário        |
-| ---------------------------------------------------------------------------------------------------- | ------------------------------------ | ----------------- |
-| {{SpecName('DOM Parsing', '#widl-Element-innerHTML', 'Element.innerHTML')}} | {{ Spec2('DOM Parsing') }} | Definição inicial |
+{{Specifications}}
+
+## Compatibilidade com navegadores
+
+{{Compat}}
 
 ## Veja também
 
diff --git a/files/pt-br/web/api/element/insertadjacenthtml/index.md b/files/pt-br/web/api/element/insertadjacenthtml/index.md
index cc39e54ba65878..ad103bec102cee 100644
--- a/files/pt-br/web/api/element/insertadjacenthtml/index.md
+++ b/files/pt-br/web/api/element/insertadjacenthtml/index.md
@@ -33,9 +33,9 @@ element.insertAdjacentHTML(posição, texto);
 ```html
 
 

- -foo - + + foo +

``` @@ -48,23 +48,21 @@ foo // Estrutura inicial: //
one
-var d1 = document.getElementById('one'); -d1.insertAdjacentHTML('afterend', '
two
'); +var d1 = document.getElementById("one"); +d1.insertAdjacentHTML("afterend", '
two
'); // Neste ponto, a nova estrutura é: //
one
//
two
``` -## Especificação +## Especificações -| Specification | Status | Comment | -| ---------------------------------------------------------------------------------------------------------------- | ------------------------------------ | ------- | -| {{SpecName('DOM Parsing', '#insertadjacenthtml()', 'Element.insertAdjacentHTML()')}} | {{ Spec2('DOM Parsing') }} | | +{{Specifications}} -## Compatibilidade de Navegadores +## Compatibilidade com navegadores -{{Compat("api.Element.insertAdjacentHTML")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/lostpointercapture_event/index.md b/files/pt-br/web/api/element/lostpointercapture_event/index.md index 0d000e45d30b79..863135123d450a 100644 --- a/files/pt-br/web/api/element/lostpointercapture_event/index.md +++ b/files/pt-br/web/api/element/lostpointercapture_event/index.md @@ -27,16 +27,14 @@ function overHandler(event) { } function init() { - let el = document.getElementById('target'); + let el = document.getElementById("target"); el.onlostpointercapture = overHandler; } ``` ## Especificações -| Specification | Status | Comment | -| ------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------- | ------- | -| {{SpecName('Pointer Events 2', '#the-lostpointercapture-event', 'onlostpointercapture')}} | {{Spec2('Pointer Events 2')}} | | +{{Specifications}} ## Compatibilidade com navegadores diff --git a/files/pt-br/web/api/element/matches/index.md b/files/pt-br/web/api/element/matches/index.md index 4139f5c51e4d0a..18f7d607a0a25d 100644 --- a/files/pt-br/web/api/element/matches/index.md +++ b/files/pt-br/web/api/element/matches/index.md @@ -28,11 +28,11 @@ var result = element.matches(selectorString); @@ -66,12 +66,10 @@ if (!Element.prototype.matches) { } ``` -## Especificação +## Especificações -| Especificação | Status | Comentário | -| -------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | -| {{SpecName('DOM WHATWG', '#dom-element-matches', 'Element.prototype.matches')}} | {{Spec2('DOM WHATWG')}} | Initial definition | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.matches")}} +{{Compat}} diff --git a/files/pt-br/web/api/element/mousedown_event/index.md b/files/pt-br/web/api/element/mousedown_event/index.md index 2e7df6c69c8224..3c2fe42900e0f7 100644 --- a/files/pt-br/web/api/element/mousedown_event/index.md +++ b/files/pt-br/web/api/element/mousedown_event/index.md @@ -24,31 +24,35 @@ O evento `mousedown` é ativado quando um botão de um dispositivo apontador é ## Propriedades -| Property | Type | Description | -| ---------------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Property | Type | Description | +| ---------------------------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `target` {{readonlyInline}} | {{domxref("EventTarget")}} | O alvo do evento (o alvo mais alto na árvore do DOM). | -| `type` {{readonlyInline}} | {{domxref("DOMString")}} | O tipo de evento | -| `bubbles` {{readonlyInline}} | Boolean | Whether the event normally bubbles or not | -| `cancelable` {{readonlyInline}} | `Boolean` | O evento é cancelável ou não? | -| `view` {{readonlyInline}} | {{domxref("WindowProxy")}} | {{domxref("document.defaultView")}} (`window` do documento) | -| `detail` {{readonlyInline}} | `long` (`float`) | Um número de cliques consecutivos que aconteceu num pequeno espaço de tempo, acrescido em um. | +| `type` {{readonlyInline}} | {{domxref("DOMString")}} | O tipo de evento | +| `bubbles` {{readonlyInline}} | Boolean | Whether the event normally bubbles or not | +| `cancelable` {{readonlyInline}} | `Boolean` | O evento é cancelável ou não? | +| `view` {{readonlyInline}} | {{domxref("WindowProxy")}} | {{domxref("document.defaultView")}} (`window` do documento) | +| `detail` {{readonlyInline}} | `long` (`float`) | Um número de cliques consecutivos que aconteceu num pequeno espaço de tempo, acrescido em um. | | `currentTarget` {{readonlyInline}} | {{domxref("EventTarget")}} | O nó que teve o listener do evento anexado. | | `relatedTarget` {{readonlyInline}} | {{domxref("EventTarget")}} | Para os eventos `mouseover`, `mouseout`, `mouseenter` e `mouseleave`: o alvo do evento complementar (o alvo do `mouseleave` no caso de um evento `mouseenter`). Caso contrário, `null`. | -| `screenX` {{readonlyInline}} | long | A coordenada X do mouse baseada nas coordenadas globais (tela). | -| `screenY` {{readonlyInline}} | long | A coordenada Y do mouse baseada nas coordenadas globais (tela). | -| `clientX` {{readonlyInline}} | long | A coordenada X do ponteiro do mouse baseada nas coordenadas locais (conteúdo do DOM). | -| `clientY` {{readonlyInline}} | long | A coordenada Y do ponteiro do mouse baseada nas coordenadas locais (conteúdo do DOM). | -| `button` {{readonlyInline}} | unsigned short | O número do botão que foi pressionado quando o evento mouse foi ativado: Botão esquerdo = 0, botão do meio = 1 (se presente), botão direito = 2. Para os mouses configurados para uso por canhotos onde as ações do mouse são invertidas, os valores são lidos da direita para a esquerda. | -| `buttons` {{readonlyInline}} | unsigned short | Os botões pressionados que foram pressionados quando o evento do mouse foi ativado: Botão esquerdo = 1, botão direito = 2, botão do meio (roda) = 4, 4º botão (geralmente, o "botão de voltar") = 8, 5º botão (geralmente, o "botão de avançar") = 16. Se dois ou mais botões são pressionados, retorna a soma lógica dos valores. Exemplo: se o Botão esquerdo e o Botão direito são pressionados, retorna 3 (=1 \| 2). [Mais informações](/pt-BR/docs/Web/API/MouseEvent). | -| `mozPressure` {{readonlyInline}} | float | A quantidade de pressão aplicada a um dispositivo touch ou tablet quando o evento estava sendo gerado; este valor varia entre 0.0 (pressão mínima) e 1.0 (pressão máxima). | -| `ctrlKey` {{readonlyInline}} | boolean | `true` se a tecla control estava pressionada quando o evento foi ativado. Caso contrário, `false`. | -| `shiftKey` {{readonlyInline}} | boolean | `true` se a tecla shift estava pressionada quando o evento foi ativado. Caso contrário, `false`. | -| `altKey` {{readonlyInline}} | boolean | `true` se a tecla alt estava pressionada quando o evento foi ativado. Caso contrário, `false`. | -| `metaKey` {{readonlyInline}} | boolean | `true` se a tecla meta estava pressionada quando o evento foi ativado. Caso contrário, `false`. | +| `screenX` {{readonlyInline}} | long | A coordenada X do mouse baseada nas coordenadas globais (tela). | +| `screenY` {{readonlyInline}} | long | A coordenada Y do mouse baseada nas coordenadas globais (tela). | +| `clientX` {{readonlyInline}} | long | A coordenada X do ponteiro do mouse baseada nas coordenadas locais (conteúdo do DOM). | +| `clientY` {{readonlyInline}} | long | A coordenada Y do ponteiro do mouse baseada nas coordenadas locais (conteúdo do DOM). | +| `button` {{readonlyInline}} | unsigned short | O número do botão que foi pressionado quando o evento mouse foi ativado: Botão esquerdo = 0, botão do meio = 1 (se presente), botão direito = 2. Para os mouses configurados para uso por canhotos onde as ações do mouse são invertidas, os valores são lidos da direita para a esquerda. | +| `buttons` {{readonlyInline}} | unsigned short | Os botões pressionados que foram pressionados quando o evento do mouse foi ativado: Botão esquerdo = 1, botão direito = 2, botão do meio (roda) = 4, 4º botão (geralmente, o "botão de voltar") = 8, 5º botão (geralmente, o "botão de avançar") = 16. Se dois ou mais botões são pressionados, retorna a soma lógica dos valores. Exemplo: se o Botão esquerdo e o Botão direito são pressionados, retorna 3 (=1 \| 2). [Mais informações](/pt-BR/docs/Web/API/MouseEvent). | +| `mozPressure` {{readonlyInline}} | float | A quantidade de pressão aplicada a um dispositivo touch ou tablet quando o evento estava sendo gerado; este valor varia entre 0.0 (pressão mínima) e 1.0 (pressão máxima). | +| `ctrlKey` {{readonlyInline}} | boolean | `true` se a tecla control estava pressionada quando o evento foi ativado. Caso contrário, `false`. | +| `shiftKey` {{readonlyInline}} | boolean | `true` se a tecla shift estava pressionada quando o evento foi ativado. Caso contrário, `false`. | +| `altKey` {{readonlyInline}} | boolean | `true` se a tecla alt estava pressionada quando o evento foi ativado. Caso contrário, `false`. | +| `metaKey` {{readonlyInline}} | boolean | `true` se a tecla meta estava pressionada quando o evento foi ativado. Caso contrário, `false`. | + +## Especificações + +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.mousedown_event")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/mouseenter_event/index.md b/files/pt-br/web/api/element/mouseenter_event/index.md index 641c71533948a0..ce2cf4826f1934 100644 --- a/files/pt-br/web/api/element/mouseenter_event/index.md +++ b/files/pt-br/web/api/element/mouseenter_event/index.md @@ -34,27 +34,27 @@ Combinado ao comportamento do seu evento simétrico, `mouseleave`, o evento DOM ## Propriedades -| Property | Type | Description | -| ---------------------------------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Property | Type | Description | +| ---------------------------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `target` {{readonlyInline}} | {{domxref("EventTarget")}} | The event target (the topmost target in the DOM tree). | -| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | -| `bubbles` {{readonlyInline}} | Boolean | Whether the event normally bubbles or not | -| `cancelable` {{readonlyInline}} | `Boolean` | Whether the event is cancellable or not? | -| `view` {{readonlyInline}} | {{domxref("WindowProxy")}} | {{domxref("document.defaultView")}} (`window` of the document) | -| `detail` {{readonlyInline}} | `long` (`float`) | 0. | +| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | +| `bubbles` {{readonlyInline}} | Boolean | Whether the event normally bubbles or not | +| `cancelable` {{readonlyInline}} | `Boolean` | Whether the event is cancellable or not? | +| `view` {{readonlyInline}} | {{domxref("WindowProxy")}} | {{domxref("document.defaultView")}} (`window` of the document) | +| `detail` {{readonlyInline}} | `long` (`float`) | 0. | | `currentTarget` {{readonlyInline}} | {{domxref("EventTarget")}} | The node that had the event listener attached. | | `relatedTarget` {{readonlyInline}} | {{domxref("EventTarget")}} | For `mouseover`, `mouseout`, `mouseenter` and `mouseleave` events: the target of the complementary event (the `mouseleave` target in the case of a `mouseenter` event). `null` otherwise. | -| `screenX` {{readonlyInline}} | long | The X coordinate of the mouse pointer in global (screen) coordinates. | -| `screenY` {{readonlyInline}} | long | The Y coordinate of the mouse pointer in global (screen) coordinates. | -| `clientX` {{readonlyInline}} | long | The X coordinate of the mouse pointer in local (DOM content) coordinates. | -| `clientY` {{readonlyInline}} | long | The Y coordinate of the mouse pointer in local (DOM content) coordinates. | -| `button` {{readonlyInline}} | unsigned short | The button number that was pressed when the mouse event was fired: Left button=0, middle button=1 (if present), right button=2. For mice configured for left handed use in which the button actions are reversed the values are instead read from right to left. | -| `buttons` {{readonlyInline}} | unsigned short | The buttons being pressed when the mouse event was fired: Left button=1, Right button=2, Middle (wheel) button=4, 4th button (typically, "Browser Back" button)=8, 5th button (typically, "Browser Forward" button)=16. If two or more buttons are pressed, returns the logical sum of the values. E.g., if Left button and Right button are pressed, returns 3 (=1 \| 2). [More info](/pt-BR/docs/Web/API/MouseEvent). | -| `mozPressure` {{readonlyInline}} | float | The amount of pressure applied to a touch or tabdevice when generating the event; this value ranges between 0.0 (minimum pressure) and 1.0 (maximum pressure). | -| `ctrlKey` {{readonlyInline}} | boolean | `true` if the control key was down when the event was fired. `false` otherwise. | -| `shiftKey` {{readonlyInline}} | boolean | `true` if the shift key was down when the event was fired. `false` otherwise. | -| `altKey` {{readonlyInline}} | boolean | `true` if the alt key was down when the event was fired. `false` otherwise. | -| `metaKey` {{readonlyInline}} | boolean | `true` if the meta key was down when the event was fired. `false` otherwise. | +| `screenX` {{readonlyInline}} | long | The X coordinate of the mouse pointer in global (screen) coordinates. | +| `screenY` {{readonlyInline}} | long | The Y coordinate of the mouse pointer in global (screen) coordinates. | +| `clientX` {{readonlyInline}} | long | The X coordinate of the mouse pointer in local (DOM content) coordinates. | +| `clientY` {{readonlyInline}} | long | The Y coordinate of the mouse pointer in local (DOM content) coordinates. | +| `button` {{readonlyInline}} | unsigned short | The button number that was pressed when the mouse event was fired: Left button=0, middle button=1 (if present), right button=2. For mice configured for left handed use in which the button actions are reversed the values are instead read from right to left. | +| `buttons` {{readonlyInline}} | unsigned short | The buttons being pressed when the mouse event was fired: Left button=1, Right button=2, Middle (wheel) button=4, 4th button (typically, "Browser Back" button)=8, 5th button (typically, "Browser Forward" button)=16. If two or more buttons are pressed, returns the logical sum of the values. E.g., if Left button and Right button are pressed, returns 3 (=1 \| 2). [More info](/pt-BR/docs/Web/API/MouseEvent). | +| `mozPressure` {{readonlyInline}} | float | The amount of pressure applied to a touch or tabdevice when generating the event; this value ranges between 0.0 (minimum pressure) and 1.0 (maximum pressure). | +| `ctrlKey` {{readonlyInline}} | boolean | `true` if the control key was down when the event was fired. `false` otherwise. | +| `shiftKey` {{readonlyInline}} | boolean | `true` if the shift key was down when the event was fired. `false` otherwise. | +| `altKey` {{readonlyInline}} | boolean | `true` if the alt key was down when the event was fired. `false` otherwise. | +| `metaKey` {{readonlyInline}} | boolean | `true` if the meta key was down when the event was fired. `false` otherwise. | ## Examples @@ -81,51 +81,64 @@ The following example illustrates how to use `mouseover` to simulate the princip ``` +## Especificações + +{{Specifications}} + ## Compatibilidade com navegadores -{{Compat("api.Element.mouseenter_event")}} +{{Compat}} ## See also diff --git a/files/pt-br/web/api/element/mouseover_event/index.md b/files/pt-br/web/api/element/mouseover_event/index.md index 8cb712f70f8785..716f24a74cfb35 100644 --- a/files/pt-br/web/api/element/mouseover_event/index.md +++ b/files/pt-br/web/api/element/mouseover_event/index.md @@ -22,27 +22,27 @@ O evento `mouseover` é acionado quando um dispositivo ponteiro é movido para o ## Propriedades -| Property | Type | Description | -| ---------------------------------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Property | Type | Description | +| ---------------------------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `target` {{readonlyInline}} | {{domxref("EventTarget")}} | O evento alvo(o mais alto alvo na arvore do DOM). | -| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | -| `bubbles` {{readonlyInline}} | Boolean | Whether the event normally bubbles or not | -| `cancelable` {{readonlyInline}} | `Boolean` | Whether the event is cancellable or not | -| `view` {{readonlyInline}} | {{domxref("WindowProxy")}} | {{domxref("document.defaultView")}} (`window` of the document) | -| `detail` {{readonlyInline}} | `long` (`float`) | 0. | +| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. | +| `bubbles` {{readonlyInline}} | Boolean | Whether the event normally bubbles or not | +| `cancelable` {{readonlyInline}} | `Boolean` | Whether the event is cancellable or not | +| `view` {{readonlyInline}} | {{domxref("WindowProxy")}} | {{domxref("document.defaultView")}} (`window` of the document) | +| `detail` {{readonlyInline}} | `long` (`float`) | 0. | | `currentTarget` {{readonlyInline}} | {{domxref("EventTarget")}} | The node that had the event listener attached. | | `relatedTarget` {{readonlyInline}} | {{domxref("EventTarget")}} | For `mouseover`, `mouseout`, `mouseenter` and `mouseleave` events: the target of the complementary event (the `mouseleave` target in the case of a `mouseenter` event). `null` otherwise. | -| `screenX` {{readonlyInline}} | long | The X coordinate of the mouse pointer in global (screen) coordinates. | -| `screenY` {{readonlyInline}} | long | The Y coordinate of the mouse pointer in global (screen) coordinates. | -| `clientX` {{readonlyInline}} | long | The X coordinate of the mouse pointer in local (DOM content) coordinates. | -| `clientY` {{readonlyInline}} | long | The Y coordinate of the mouse pointer in local (DOM content) coordinates. | -| `button` {{readonlyInline}} | unsigned short | This is always 0 as no button presses trigger this event (mouse movement does). | -| `buttons` {{readonlyInline}} | unsigned short | The buttons depressed when the mouse event was fired: Left button=1, Right button=2, Middle (wheel) button=4, 4th button (typically, "Browser Back" button)=8, 5th button (typically, "Browser Forward" button)=16. If two or more buttons are depressed, returns the logical sum of the values. E.g., if Left button and Right button are depressed, returns 3 (=1 \| 2). [More info](/pt-BR/docs/Web/API/MouseEvent). | -| `mozPressure` {{readonlyInline}} | float | The amount of pressure applied to a touch or tabdevice when generating the event; this value ranges between 0.0 (minimum pressure) and 1.0 (maximum pressure). | -| `ctrlKey` {{readonlyInline}} | boolean | `true` if the control key was down when the event was fired. `false` otherwise. | -| `shiftKey` {{readonlyInline}} | boolean | `true` if the shift key was down when the event was fired. `false` otherwise. | -| `altKey` {{readonlyInline}} | boolean | `true` if the alt key was down when the event was fired. `false` otherwise. | -| `metaKey` {{readonlyInline}} | boolean | `true` if the meta key was down when the event was fired. `false` otherwise. | +| `screenX` {{readonlyInline}} | long | The X coordinate of the mouse pointer in global (screen) coordinates. | +| `screenY` {{readonlyInline}} | long | The Y coordinate of the mouse pointer in global (screen) coordinates. | +| `clientX` {{readonlyInline}} | long | The X coordinate of the mouse pointer in local (DOM content) coordinates. | +| `clientY` {{readonlyInline}} | long | The Y coordinate of the mouse pointer in local (DOM content) coordinates. | +| `button` {{readonlyInline}} | unsigned short | This is always 0 as no button presses trigger this event (mouse movement does). | +| `buttons` {{readonlyInline}} | unsigned short | The buttons depressed when the mouse event was fired: Left button=1, Right button=2, Middle (wheel) button=4, 4th button (typically, "Browser Back" button)=8, 5th button (typically, "Browser Forward" button)=16. If two or more buttons are depressed, returns the logical sum of the values. E.g., if Left button and Right button are depressed, returns 3 (=1 \| 2). [More info](/pt-BR/docs/Web/API/MouseEvent). | +| `mozPressure` {{readonlyInline}} | float | The amount of pressure applied to a touch or tabdevice when generating the event; this value ranges between 0.0 (minimum pressure) and 1.0 (maximum pressure). | +| `ctrlKey` {{readonlyInline}} | boolean | `true` if the control key was down when the event was fired. `false` otherwise. | +| `shiftKey` {{readonlyInline}} | boolean | `true` if the shift key was down when the event was fired. `false` otherwise. | +| `altKey` {{readonlyInline}} | boolean | `true` if the alt key was down when the event was fired. `false` otherwise. | +| `metaKey` {{readonlyInline}} | boolean | `true` if the meta key was down when the event was fired. `false` otherwise. | ## Example @@ -58,35 +58,45 @@ The following example illustrates the difference between `mouseover` and [`mouse ``` +## Especificações + +{{Specifications}} + ## Compatibilidade com navegadores -{{Compat("api.Element.mouseover_event")}} +{{Compat}} ## See also diff --git a/files/pt-br/web/api/element/outerhtml/index.md b/files/pt-br/web/api/element/outerhtml/index.md index de7fdabf72423b..8264c999c9a755 100644 --- a/files/pt-br/web/api/element/outerhtml/index.md +++ b/files/pt-br/web/api/element/outerhtml/index.md @@ -58,7 +58,7 @@ console.log(container.firstChild.nodeName); // mostra "P" Se o elemento não tiver um nó pai, ou seja se o nó é a raiz do documento, tentar alterar sua propriedade outerHTML irá lançar um [`DOMException`](/pt-BR/DOM/DOMException) com o código de erro `NO_MODIFICATION_ALLOWED_ERR`. Por exemplo: ```js -document.documentElement.outerHTML = "test"; // Irá lançar uma DOMException +document.documentElement.outerHTML = "test"; // Irá lançar uma DOMException ``` inclusive, quando o elemento for substituído na estrutura do documento, a variável a qual a propriedade `outerHTML` foi atribuída ainda irá conter uma referência para o elemento original. @@ -70,15 +70,13 @@ p.outerHTML = "
Esta div substituiu o parágrafo.
"; console.log(p.nodeName); // ainda contém "P"; ``` -## Especificação +## Especificações -| Specification | Status | Comment | -| ------------------------------------------------------------------------------------ | ------------------------------------ | ------- | -| {{SpecName('DOM Parsing', '#outerhtml', 'Element.outerHTML')}} | {{ Spec2('DOM Parsing') }} | | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.outerHTML")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/queryselector/index.md b/files/pt-br/web/api/element/queryselector/index.md index be842de6946688..7408592b2e5208 100644 --- a/files/pt-br/web/api/element/queryselector/index.md +++ b/files/pt-br/web/api/element/queryselector/index.md @@ -21,7 +21,9 @@ elemento = elementoBase.querySelector(seletores); Neste exemplo é retornado o primeiro elemento `style` que, ou não tem nenhum atributo type, ou tem o atributo type igual a `text/css`: ```js -var el = document.body.querySelector("style[type='text/css'], style:not([type])"); +var el = document.body.querySelector( + "style[type='text/css'], style:not([type])", +); ``` ## Notas diff --git a/files/pt-br/web/api/element/queryselectorall/index.md b/files/pt-br/web/api/element/queryselectorall/index.md index 2baa0c218123ee..5189225bf30a10 100644 --- a/files/pt-br/web/api/element/queryselectorall/index.md +++ b/files/pt-br/web/api/element/queryselectorall/index.md @@ -26,20 +26,20 @@ Onde Este exemplo retorna uma lista de todos os elementos `p` no corpo do HTML: ```js -var matches = document.body.querySelectorAll('p'); +var matches = document.body.querySelectorAll("p"); ``` Este exemplo retorna uma lista de elementos `p` que estejam contidos em outro elemento, o qual é uma `div` que tem a classe 'highlighted': ```js -var el = document.querySelector('#test'); -var matches = el.querySelectorAll('div.highlighted > p'); +var el = document.querySelector("#test"); +var matches = el.querySelectorAll("div.highlighted > p"); ``` Este exemplo retorna uma lista de elementos `iframe` que contenham um atributo **data** 'src': ```js -var matches = el.querySelectorAll('iframe[data-src]'); +var matches = el.querySelectorAll("iframe[data-src]"); ``` ## Notas @@ -52,13 +52,13 @@ A _string_ passada como argumento para `querySelectorAll` deve seguir a sintaxe Lembre-se que o valor retornado é uma NodeList, então não é recomendado o uso de recursões for...in, nem de nenhum método de _array_. Se realmente houver a necessidade de usar métodos de uma _array,_ então o NodeList deve ser convertido em uma _array_ antes de ser usado. -## Compatibilidade com navegadores +## Especificações -{{Compat("api.Element.querySelectorAll")}} +{{Specifications}} -## Especificações +## Compatibilidade com navegadores -- [Selectors API](https://www.w3.org/TR/selectors-api/) +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/scroll_event/index.md b/files/pt-br/web/api/element/scroll_event/index.md index 4dc2363cb8bdc4..ecc86c7cbeb7dd 100644 --- a/files/pt-br/web/api/element/scroll_event/index.md +++ b/files/pt-br/web/api/element/scroll_event/index.md @@ -48,8 +48,8 @@ textarea { ### JavaScript ```js -const textarea = document.querySelector('textarea'); -const log = document.getElementById('log'); +const textarea = document.querySelector("textarea"); +const log = document.getElementById("log"); textarea.onscroll = logScroll; @@ -64,10 +64,7 @@ function logScroll(e) { ## Especificações -| Especificação | Status | Comentário | -| -------------------------------------------------------------------------------- | -------------------------------- | ------------------ | -| {{SpecName('HTML WHATWG','#handler-onscroll','onscroll')}} | {{Spec2('HTML WHATWG')}} | | -| {{SpecName("DOM3 Events", "#event-type-scroll", "onscroll")}} | {{Spec2("DOM3 Events")}} | Initial definition | +{{Specifications}} ## Compatibilidade com navegadores diff --git a/files/pt-br/web/api/element/scrollintoview/index.md b/files/pt-br/web/api/element/scrollintoview/index.md index 72d8f0622bc5b6..c732768ee6d25d 100644 --- a/files/pt-br/web/api/element/scrollintoview/index.md +++ b/files/pt-br/web/api/element/scrollintoview/index.md @@ -47,8 +47,8 @@ var element = document.getElementById("box"); element.scrollIntoView(); element.scrollIntoView(false); -element.scrollIntoView({block: "end"}); -element.scrollIntoView({block: "end", behavior: "smooth"}); +element.scrollIntoView({ block: "end" }); +element.scrollIntoView({ block: "end", behavior: "smooth" }); ``` ## Observações @@ -57,13 +57,11 @@ O elemento poderá não ser movido completamento ao topo ou ao fundo dependendo ## Especificações -| Especificação | Status | Comentário | -| ---------------------------------------------------------------------------------------------------------------- | -------------------------------- | ----------------- | -| {{SpecName("CSSOM View", "#dom-element-scrollintoview", "Element.scrollIntoView()")}} | {{Spec2("CSSOM View")}} | Definição inicial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.scrollIntoView")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/element/scrollleft/index.md b/files/pt-br/web/api/element/scrollleft/index.md index 4a3b7b590cec47..097130bc828785 100644 --- a/files/pt-br/web/api/element/scrollleft/index.md +++ b/files/pt-br/web/api/element/scrollleft/index.md @@ -2,6 +2,7 @@ title: Element.scrollLeft slug: Web/API/Element/scrollLeft --- + {{ APIRef("DOM") }} A propriedade **Element.scrollLeft** obtem, ou define o número de pixels do contéudo de um elemento que é rolado para a esquerda. @@ -31,42 +32,48 @@ element.scrollLeft = 10; ## Exemplo ```html - + - - + + - - + +
-
Lorem ipsum dolor sit amet.
+
Lorem ipsum dolor sit amet.
- + ``` ## Especificações -| Especificações | Status | Comentário | -| ---------------------------------------------------------------------------------------- | -------------------------------- | ---------- | -| {{SpecName('CSSOM View', '#dom-element-scrollleft', 'scrollLeft')}} | {{Spec2("CSSOM View")}} | | +{{Specifications}} -## Referências +## Compatibilidade com navegadores -{{Compat("api.Element.scrollLeft")}} +{{Compat}} diff --git a/files/pt-br/web/api/element/scrolltop/index.md b/files/pt-br/web/api/element/scrolltop/index.md index 35c98f97281802..ee53cc8373259e 100644 --- a/files/pt-br/web/api/element/scrolltop/index.md +++ b/files/pt-br/web/api/element/scrolltop/index.md @@ -43,9 +43,11 @@ padding-bottom ## Especificações -| Specification | Status | Comment | -| ---------------------------------------------------------------------------------------- | -------------------------------- | ------- | -| {{SpecName('CSSOM View', '#dom-element-scrolltop', 'scrollTop')}} | {{Spec2("CSSOM View")}} | | +{{Specifications}} + +## Compatibilidade com navegadores + +{{Compat}} ## Referências diff --git a/files/pt-br/web/api/element/scrollwidth/index.md b/files/pt-br/web/api/element/scrollwidth/index.md index 9465aff25f9231..1cc9827da8bd03 100644 --- a/files/pt-br/web/api/element/scrollwidth/index.md +++ b/files/pt-br/web/api/element/scrollwidth/index.md @@ -20,76 +20,68 @@ _xScrollWidth_ é a largura do conteúdo do _elemento_ em pixels. ## Exemplo ```html - + - + Example - - - -
- FooBar-FooBar-FooBar-FooBar -
- - -
- FooBar-FooBar-FooBar-FooBar -
- - - + ``` ## Especificação -| Especificação | Status | Comentário | -| -------------------------------------------------------------------------------------------------------- | -------------------------------- | ----------------- | +| Especificação | Status | Comentário | +| ----------------------------------------------------------------------------- | ----------------------- | ----------------- | | {{SpecName("CSSOM View", "#dom-element-scrollwidth", "Element.scrollWidth")}} | {{Spec2("CSSOM View")}} | Definição inicial | ## Referências diff --git a/files/pt-br/web/api/element/tagname/index.md b/files/pt-br/web/api/element/tagname/index.md index d87a58e5af229f..8a53bf5ac7e6fd 100644 --- a/files/pt-br/web/api/element/tagname/index.md +++ b/files/pt-br/web/api/element/tagname/index.md @@ -38,11 +38,8 @@ Em XHTML (ou qualquer outro formato XML), "`span`" será a saída. Em HTML, "`SP ## Especificações -| Especificação | Status | Comentário | -| -------------------------------------------------------------------------------------------- | ---------------------------- | ------------------ | -| {{SpecName("DOM3 Core", "core.html#ID-104682815", "Element.tagName")}} | {{Spec2("DOM3 Core")}} | No change | -| {{SpecName("DOM2 Core", "core.html#ID-104682815", "Element.tagName")}} | {{Spec2("DOM2 Core")}} | Initial definition | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Element.tagName")}} +{{Compat}} diff --git a/files/pt-br/web/api/element/touchstart_event/index.md b/files/pt-br/web/api/element/touchstart_event/index.md index a9d64f23ada091..5ea7fd0f22bf80 100644 --- a/files/pt-br/web/api/element/touchstart_event/index.md +++ b/files/pt-br/web/api/element/touchstart_event/index.md @@ -2,7 +2,8 @@ title: touchstart slug: Web/API/Element/touchstart_event --- -`O evento touchstart` é acionado quando o ponteiro de toque*(dedo ou caneta)* é aplicado sobre à superfície de toque da tela*(toque sobre a tela no elemento alvo)*. + +`O evento touchstart` é acionado quando o ponteiro de toque *(dedo ou caneta)* é aplicado sobre à superfície de toque da tela *(toque sobre a tela no elemento alvo)*. ## Info Geral @@ -21,16 +22,16 @@ slug: Web/API/Element/touchstart_event ## Propriedades -| Property | Type | Description | -| ----------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Property | Type | Description | +| ----------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `target` {{readonlyInline}} | EventTarget | The event target (the topmost target in the DOM tree). | | `type` {{readonlyInline}} | DOMString | The type of event. | | `bubbles` {{readonlyInline}} | Boolean | Whether the event normally bubbles or not. | | `cancelable` {{readonlyInline}} | Boolean | Whether the event is cancellable or not. | -| `view` {{readonlyInline}} | WindowProxy | [`document.defaultView`](/pt-BR/docs/Web/API/Document/defaultView) (`window` of the document) | +| `view` {{readonlyInline}} | WindowProxy | [`document.defaultView`](/pt-BR/docs/Web/API/Document/defaultView) (`window` of the document) | | `detail` {{readonlyInline}} | long (float) | 0. | -| `touches` {{readonlyInline}} | TouchList | A list of [`Touch`](/pt-BR/DOM/Touch)es for every point of contact currently touching the surface. | -| `targetTouches` {{readonlyInline}} | TouchList | A list of [`Touch`](/pt-BR/DOM/Touch)es for every point of contact that is touching the surface and started on the element that is the target of the current event. | +| `touches` {{readonlyInline}} | TouchList | A list of [`Touch`](/pt-BR/DOM/Touch)es for every point of contact currently touching the surface. | +| `targetTouches` {{readonlyInline}} | TouchList | A list of [`Touch`](/pt-BR/DOM/Touch)es for every point of contact that is touching the surface and started on the element that is the target of the current event. | | `changedTouches` {{readonlyInline}} | TouchList | A list of [`Touch`](/pt-BR/docs/DOM/Touch)es for every point of contact which contributed to the event. For the touchstart event this must be a list of the touch points that just became active with the current event. For the touchmove event this must be a list of the touch points that have moved since the last event. For the touchend and touchcancel events this must be a list of the touch points that have just been removed from the surface. | | `ctrlKey` {{readonlyInline}} | boolean | `true` if the control key was down when the event was fired. `false` otherwise. | | `shiftKey` {{readonlyInline}} | boolean | `true` if the shift key was down when the event was fired. `false` otherwise. | @@ -41,9 +42,13 @@ slug: Web/API/Element/touchstart_event Os códigos de exemplos para este evento estão disponíveis nesta página dedicada: [Touch events](/pt-BR/DOM/Touch_events). +## Especificações + +{{Specifications}} + ## Compatibilidade com navegadores -{{Compat("api.Element.touchstart_event")}} +{{Compat}} ## Eventos Relacionados diff --git a/files/pt-br/web/api/encoding_api/index.md b/files/pt-br/web/api/encoding_api/index.md index 4c1782cffe4c24..bcba178d30d02e 100644 --- a/files/pt-br/web/api/encoding_api/index.md +++ b/files/pt-br/web/api/encoding_api/index.md @@ -2,6 +2,7 @@ title: Encoding API slug: Web/API/Encoding_API --- + {{DefaultAPISidebar("Encoding API")}}{{SeeCompatTable}} O **Encoding API** providência uma mecânismo para tratar textos em vários tipos de {{Glossary("character encoding", "encode de caracteres")}}, incluindo encodes legados non-{{Glossary("UTF-8")}} @@ -20,16 +21,10 @@ A API provém de quatro interfaces: {{domxref("TextDecoder")}}, {{domxref("TextE - O [shim](http://code.google.com/p/stringencoding/) permite usar essa interface em navegadores que não a suportam. - [`StringView`](/pt-BR/Add-ons/Code_snippets/StringView) – Um C-like reperesentação de strings baseados em arrays tipados -| Specification | Status | Comment | -| -------------------------------- | ---------------------------- | ------------------ | -| {{SpecName("Encoding")}} | {{Spec2("Encoding")}} | Definição inicial. | - -## Compatibilidade com navegadores +## Especificações -### `TextDecoder` +{{Specifications}} -{{Compat("api.TextDecoder")}} - -### `TextEncoder` +## Compatibilidade com navegadores -{{Compat("api.TextEncoder")}} +{{Compat}} diff --git a/files/pt-br/web/api/event/comparison_of_event_targets/index.md b/files/pt-br/web/api/event/comparison_of_event_targets/index.md index f28cb5913d79d3..843a4f811d4ed2 100644 --- a/files/pt-br/web/api/event/comparison_of_event_targets/index.md +++ b/files/pt-br/web/api/event/comparison_of_event_targets/index.md @@ -211,10 +211,10 @@ TODO: Adequado apenas para desenvolvedores de extensões? A propriedade `relatedTarget` do evento de `mouseover` mantém o nó de onde o mouse estava sobre anteriormente. Para o evento de `mouseout`, mantém o nó para onde o mouse se moveu. -| Tipo de Evento | [event.target](/pt-BR/DOM/event.target) | [event.relatedTarget](/pt-BR/DOM/event.relatedTarget) | -| -------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `mouseover` | O EventTarget do qual o dispositivo apontador entrou. | O EventTarget do qual o dispositivo apontador saiu. | -| `mouseout` | O EventTarget do qual o dispositivo apontador saiu. | O EventTarget do qual o dispositivo apontador entrou. | +| Tipo de Evento | [event.target](/pt-BR/DOM/event.target) | [event.relatedTarget](/pt-BR/DOM/event.relatedTarget) | +| -------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `mouseover` | O EventTarget do qual o dispositivo apontador entrou. | O EventTarget do qual o dispositivo apontador saiu. | +| `mouseout` | O EventTarget do qual o dispositivo apontador saiu. | O EventTarget do qual o dispositivo apontador entrou. | TODO: Necessário descrição complemento sobre eventos de `dragenter` e `dragexit`. diff --git a/files/pt-br/web/api/event/currenttarget/index.md b/files/pt-br/web/api/event/currenttarget/index.md index 892333b0abaee6..e307994e165b8f 100644 --- a/files/pt-br/web/api/event/currenttarget/index.md +++ b/files/pt-br/web/api/event/currenttarget/index.md @@ -12,37 +12,32 @@ Identifica o alvo atual para o evento quando o event percorre o DOM. O currentTa `event.currentTarget` é bom para ser usado quando nós queremos associar o mesmo event handler para vários elementos. ```js -function hide(e){ +function hide(e) { e.currentTarget.style.visibility = "hidden"; console.log(e.currentTarget); // Quando essa função é usada como um event // handler: this === e.currentTarget } -var ps = document.getElementsByTagName('p'); +var ps = document.getElementsByTagName("p"); -for(var i = 0; i < ps.length; i++){ +for (var i = 0; i < ps.length; i++) { // console: print the clicked

element - ps[i].addEventListener('click', hide, false); + ps[i].addEventListener("click", hide, false); } // console: print -document.body.addEventListener('click', hide, false); +document.body.addEventListener("click", hide, false); // Clique e faça os parágrafos desaparecerem ``` ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------------------------------ | -------------------------------- | ---------------- | -| {{SpecName("DOM WHATWG", "#dom-event-currenttarget", "Event.currentTarget")}} | {{Spec2("DOM WHATWG")}} | | -| {{SpecName("DOM4", "#dom-event-currenttarget", "Event.currentTarget")}} | {{Spec2("DOM4")}} | | -| {{SpecName("DOM3 Events", "#dfn-current-event-target", "current event target")}} | {{Spec2("DOM3 Events")}} | | -| {{SpecName("DOM2 Events", "#Events-Event-currentTarget", "Event.currentTarget")}} | {{Spec2("DOM2 Events")}} | Definição incial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Event.currentTarget")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/event/event/index.md b/files/pt-br/web/api/event/event/index.md index ef93bb96feaa3a..fa0cd44dcf1819 100644 --- a/files/pt-br/web/api/event/event/index.md +++ b/files/pt-br/web/api/event/event/index.md @@ -29,19 +29,17 @@ O **`Event()`** cria uma nova {{domxref("Event")}}. ```js // criar um evento com bubbles true e que não pode ser cancelado -var ev = new Event("look", {"bubbles":true, "cancelable":false}); +var ev = new Event("look", { bubbles: true, cancelable: false }); document.dispatchEvent(ev); ``` ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------ | -------------------------------- | ------------------ | -| {{SpecName('DOM WHATWG','#interface-event','Event()')}} | {{Spec2('DOM WHATWG')}} | Definição inicial. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Event.Event")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/event/initevent/index.md b/files/pt-br/web/api/event/initevent/index.md index f0491537580a17..e3ec29a82da898 100644 --- a/files/pt-br/web/api/event/initevent/index.md +++ b/files/pt-br/web/api/event/initevent/index.md @@ -46,14 +46,11 @@ elem.dispatchEvent(event); ## Especificações -| Especificação | Estado | Comentário | -| ---------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------- | -| {{SpecName('DOM WHATWG', '#dom-event-initevent','Event.initEvent()')}} | {{Spec2("DOM WHATWG")}} | From {{SpecName('DOM2 Events')}}, deprecated it, superseded by event constructors. | -| {{SpecName('DOM2 Events','##Events-Event-initEvent','Event.initEvent()')}} | {{Spec2('DOM2 Events')}} | Initial definition. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Event.initEvent")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/event/istrusted/index.md b/files/pt-br/web/api/event/istrusted/index.md index b599d3dd61d77a..a392f9ce53ff4f 100644 --- a/files/pt-br/web/api/event/istrusted/index.md +++ b/files/pt-br/web/api/event/istrusted/index.md @@ -28,11 +28,8 @@ if (e.isTrusted) { ## Especificações -| Especifiação | Status | Comentário | -| -------------------------------------------------------------------------------------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| {{SpecName('DOM WHATWG', '#dom-event-istrusted', 'Event.isTrusted')}} | {{ Spec2('DOM WHATWG') }} | | -| {{SpecName('DOM3 Events', '#trusted-events', 'Trusted events')}} | {{Spec2('DOM3 Events')}} | Amplia requisito para confiabilidade de um evento, embora isto não defina por si só a propriedade `isTrusted`. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Event.isTrusted")}} +{{Compat}} diff --git a/files/pt-br/web/api/event/preventdefault/index.md b/files/pt-br/web/api/event/preventdefault/index.md index 01ed1433f62cc0..357ee44265b66c 100644 --- a/files/pt-br/web/api/event/preventdefault/index.md +++ b/files/pt-br/web/api/event/preventdefault/index.md @@ -20,32 +20,30 @@ event.preventDefault(); Alternar é a ação padrão de clicar em uma caixa de seleção. Este exemplo demonstra como impedir que isso aconteça: ```html - + - -preventDefault example - - - + + preventDefault example - + + -

- - -
+ +

Please click on the checkbox control.

- +
+ + +
+ ``` @@ -63,22 +61,25 @@ O exemplo a seguir demonstra como um input com texto inválido pode ser parado a ``` ```js -function Init () { - var myTextbox = document.getElementById('my-textbox'); - myTextbox.addEventListener( 'keypress', checkName, false ); +function Init() { + var myTextbox = document.getElementById("my-textbox"); + myTextbox.addEventListener("keypress", checkName, false); } function checkName(evt) { - var charCode = evt.charCode; - if (charCode != 0) { - if (charCode < 97 || charCode > 122) { - evt.preventDefault(); - alert( - "Please use lowercase letters only." - + "\n" + "charCode: " + charCode + "\n" - ); - } + var charCode = evt.charCode; + if (charCode != 0) { + if (charCode < 97 || charCode > 122) { + evt.preventDefault(); + alert( + "Please use lowercase letters only." + + "\n" + + "charCode: " + + charCode + + "\n", + ); } + } } ``` @@ -108,6 +109,10 @@ Você pode usar o [event.cancelable](/pt-BR/docs/Web/API/event.cancelable) para `Se o preventDefault não parar a propagação do evento através do DOM. event.stopPropagation deve ser usada para isso.` -## Especificação +## Especificações + +{{Specifications}} + +## Compatibilidade com navegadores -- [DOM Level 2 Events: preventDefault](https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-Event-preventDefault) +{{Compat}} diff --git a/files/pt-br/web/api/event/stopimmediatepropagation/index.md b/files/pt-br/web/api/event/stopimmediatepropagation/index.md index 27e57952034454..207c5d9508fa61 100644 --- a/files/pt-br/web/api/event/stopimmediatepropagation/index.md +++ b/files/pt-br/web/api/event/stopimmediatepropagation/index.md @@ -19,11 +19,8 @@ No caso de um evento onde vários _listeners_ o estão escutando, os mesmos são ## Especificações -| Especificação | Status | Comentários | -| ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | -| {{SpecName('DOM WHATWG', '#dom-event-stopimmediatepropagation', 'Event.stopImmediatePropagation()')}} | {{Spec2('DOM WHATWG')}} | | -| {{SpecName('DOM4', '#dom-event-stopimmediatepropagation', 'Event.stopImmediatePropagation()')}} | {{Spec2('DOM4')}} | Initial definition | +{{Specifications}} -## Compatibilidade +## Compatibilidade com navegadores -{{Compat("api.Event.stopImmediatePropagation")}} +{{Compat}} diff --git a/files/pt-br/web/api/event/target/index.md b/files/pt-br/web/api/event/target/index.md index 2edad03b83a183..06781e899cfb46 100644 --- a/files/pt-br/web/api/event/target/index.md +++ b/files/pt-br/web/api/event/target/index.md @@ -21,10 +21,10 @@ A propriedade **`event.target`** pode ser usada para implementar a delegação d // Assumindo que existe uma variável 'list' contendo uma instância de um elemento ul de HTML. function hide(e) { // A menos que os itens da lista sejam separados por uma margem, e.target deve ser diferente de e.currentTarget - e.target.style.visibility = 'hidden'; + e.target.style.visibility = "hidden"; } -list.addEventListener('click', hide, false); +list.addEventListener("click", hide, false); // Se algum elemento (elemento
  • ou um link dentro de um elemento
  • por exemplo) for clicado, ele desaparecerá. // Só requer um único listener para fazer isso. @@ -32,15 +32,11 @@ list.addEventListener('click', hide, false); ## Especificações -| Specification | Status | Comment | -| ---------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | -| {{SpecName("DOM WHATWG", "#dom-event-target", "Event.target")}} | {{Spec2("DOM WHATWG")}} | | -| {{SpecName("DOM4", "#dom-event-target", "Event.target")}} | {{Spec2("DOM4")}} | | -| {{SpecName("DOM2 Events", "#Events-Event-target", "Event.target")}} | {{Spec2("DOM2 Events")}} | Initial definition | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Event.target")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/event/type/index.md b/files/pt-br/web/api/event/type/index.md index f1ab6c1f47f57a..e0d8538711f2f4 100644 --- a/files/pt-br/web/api/event/type/index.md +++ b/files/pt-br/web/api/event/type/index.md @@ -26,36 +26,38 @@ var string = event.type; ``` ```html - + - - -exemplo de tipo - - - - - - -

    Pressione uma tecla ou clique com o mouse para obter o tipo de evento.

    -

    Tipo de evento: -

    - - + + exemplo de tipo + + + + + +

    + Pressione uma tecla ou clique com o mouse para obter o tipo de evento. +

    +

    Tipo de evento: -

    + ``` -## Especificação +## Especificações + +{{Specifications}} + +## Compatibilidade com navegadores -- [type](https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-Event-type) +{{Compat}} diff --git a/files/pt-br/web/api/eventsource/error_event/index.md b/files/pt-br/web/api/eventsource/error_event/index.md index 60bf18a92b43a4..3992b582e17df1 100644 --- a/files/pt-br/web/api/eventsource/error_event/index.md +++ b/files/pt-br/web/api/eventsource/error_event/index.md @@ -17,7 +17,7 @@ eventSource.onerror = function ## Exemplos ```js -evtSource.onerror = function() { +evtSource.onerror = function () { console.log("EventSource failed."); }; ``` @@ -26,13 +26,11 @@ evtSource.onerror = function() { ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------------------------------ | -------------------------------- | ----------------- | -| {{SpecName('HTML WHATWG', "comms.html#handler-eventsource-onerror", "onerror")}} | {{Spec2('HTML WHATWG')}} | Definição inicial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.EventSource.error_event")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/eventsource/eventsource/index.md b/files/pt-br/web/api/eventsource/eventsource/index.md index 18768eaeeeda1a..4fd6bcae34c9d8 100644 --- a/files/pt-br/web/api/eventsource/eventsource/index.md +++ b/files/pt-br/web/api/eventsource/eventsource/index.md @@ -26,28 +26,26 @@ eventSource = new EventSource(url, configuration); ## Exemplos ```js -var evtSource = new EventSource('sse.php'); -var eventList = document.querySelector('ul'); +var evtSource = new EventSource("sse.php"); +var eventList = document.querySelector("ul"); -evtSource.onmessage = function(e) { +evtSource.onmessage = function (e) { var newElement = document.createElement("li"); newElement.textContent = "message: " + e.data; eventList.appendChild(newElement); -} +}; ``` > **Nota:** Você pode encontrar um exemplo completo no GitHub — veja [Simple SSE demo using PHP.](https://github.com/mdn/dom-examples/tree/master/server-sent-events) ## Especificações -| Specification | Status | Comment | -| ---------------------------------------------------------------------------------------------------- | -------------------------------- | ----------------- | -| {{SpecName('HTML WHATWG', "comms.html#dom-eventsource", "EventSource()")}} | {{Spec2('HTML WHATWG')}} | Definição inicial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.EventSource.EventSource")}} +{{Compat}} ## See also diff --git a/files/pt-br/web/api/eventsource/index.md b/files/pt-br/web/api/eventsource/index.md index 070a16dad1cf27..2266880a98e10f 100644 --- a/files/pt-br/web/api/eventsource/index.md +++ b/files/pt-br/web/api/eventsource/index.md @@ -48,15 +48,15 @@ _Essa interface herda métodos de seu pai, {{domxref("EventTarget")}}._ Nesse exemplo básico, um `EventSource` é criado para receber eventos do servidor; a página com o nome `"sse.php"` é responsável por gerar os eventos. ```js -var evtSource = new EventSource('sse.php'); -var eventList = document.querySelector('ul'); +var evtSource = new EventSource("sse.php"); +var eventList = document.querySelector("ul"); -evtSource.onmessage = function(e) { +evtSource.onmessage = function (e) { var newElement = document.createElement("li"); newElement.textContent = "message: " + e.data; eventList.appendChild(newElement); -} +}; ``` Cada evento recebido faz com que o handler do evento `onmessage` no objeto `EventSource` seja executado. Ele, em contrapartida, cria um novo elemento {{HTMLElement("li")}} e escreve os dados da mensagem nele, e em seguida concatena o novo elemento na lista já presente no documento. @@ -65,13 +65,11 @@ Cada evento recebido faz com que o handler do evento `onmessage` no objeto `Even ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------------------------------ | -------------------------------- | ---------- | -| {{SpecName('HTML WHATWG', "comms.html#the-eventsource-interface", "EventSource")}} | {{Spec2('HTML WHATWG')}} | | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.EventSource")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/eventtarget/addeventlistener/index.md b/files/pt-br/web/api/eventtarget/addeventlistener/index.md index 002c7bb82e20ec..2427c35a710dd8 100644 --- a/files/pt-br/web/api/eventtarget/addeventlistener/index.md +++ b/files/pt-br/web/api/eventtarget/addeventlistener/index.md @@ -31,41 +31,46 @@ alvo.addEventListener(type,listener[, useCapture, wantUntrusted {{ Non-standard_ ## Exemplo ```html - + - -Exemplo de Evento DOM - - - - - - - - - - - -
    one
    two
    - - + + Exemplo de Evento DOM + + + + + + + + + + + + + +
    one
    two
    + ``` @@ -76,40 +81,50 @@ No exemplo acima, `modifyText()` é uma escuta para eventos de `click` registrad Se você deseja passar parâmetros para a função de escuta, você deve usar uma função anônima. ```html - + - -Exemplo de Evento DOM - - - - - - - - - - - -
    one
    two
    - - + + Exemplo de Evento DOM + + + + + + + + + + + + + +
    one
    two
    + ``` @@ -142,6 +157,7 @@ Nos exemplos acima, o valor de this em modifyText(), quando disparado pelo event ```html . . . +
    ``` O valor de this em modifyText(), quando disparado pelo evento de clique no HTML, será uma referência ao objeto global (no caso, a janela). @@ -151,40 +167,38 @@ O valor de this em modifyText(), quando disparado pelo evento de clique no HTML, Este é um exemplo com e sem `bind`: ```js -var Algo = function(elemento) -{ - this.nome = 'Algo bom'; - this.onclick1 = function(evento) { +var Algo = function (elemento) { + this.nome = "Algo bom"; + this.onclick1 = function (evento) { console.log(this.nome); // indefinido, porque this é a função de escuta do clique }; - this.onclick2 = function(evento) { + this.onclick2 = function (evento) { console.log(this.nome); // 'Algo bom', porque this está como objeto Algo através do bind }; - elemento.addEventListener('click', this.onclick1, false); - elemento.addEventListener('click', this.onclick2.bind(this), false); // Truque de bind -} + elemento.addEventListener("click", this.onclick1, false); + elemento.addEventListener("click", this.onclick2.bind(this), false); // Truque de bind +}; ``` Outra solução é usar uma função especial chamada `handleEvent` para capturar quaisquer eventos: ```js -var Algo = function(elemento) -{ - this.nome = 'Algo bom'; - this.handleEvent = function(evento) { +var Algo = function (elemento) { + this.nome = "Algo bom"; + this.handleEvent = function (evento) { console.log(this.nome); // 'Algo bom', porque this é o objeto Algo - switch(evento.type) { - case 'click': + switch (evento.type) { + case "click": // seu codigo aqui... break; - case 'dblclick': + case "dblclick": // seu codigo aqui... break; } }; - elemento.addEventListener('click', this, false); // Não this.handleEvent, só this - elemento.addEventListener('dblclick', this, false); // Não this.handleEvent, só this -} + elemento.addEventListener("click", this, false); // Não this.handleEvent, só this + elemento.addEventListener("dblclick", this, false); // Não this.handleEvent, só this +}; ``` ### Internet Explorer antigos e attachEvent @@ -193,9 +207,9 @@ Em versões do Internet Explorer anteriores ao IE9, você precisa usar [`attachE ```js if (el.addEventListener) { - el.addEventListener('click', modifyText, false); -} else if (el.attachEvent) { - el.attachEvent('onclick', modifyText); + el.addEventListener("click", modifyText, false); +} else if (el.attachEvent) { + el.attachEvent("onclick", modifyText); } ``` @@ -210,8 +224,8 @@ Existe um porém com `attachEvent` o valor de `this` será a referência ao obje el.onclick = modifyText; // Usando uma expressão de função -element.onclick = function() { - // ... lógica da função ... +element.onclick = function () { + // ... lógica da função ... }; ``` @@ -242,17 +256,16 @@ for(i=0 ; i + - - -File(s) size - - - - -
    -

    selected files: 0; total size: 0

    -

    -
    - + + + File(s) size + + + + +
    +

    + + selected files: 0; total size: + 0 +

    +

    +
    + ``` @@ -220,7 +254,11 @@ function handleFiles(files) { preview.appendChild(img); var reader = new FileReader(); - reader.onload = (function(aImg) { return function(e) { aImg.src = e.target.result; }; })(img); + reader.onload = (function (aImg) { + return function (e) { + aImg.src = e.target.result; + }; + })(img); reader.readAsDataURL(file); } } @@ -239,7 +277,13 @@ This example uses object URLs to display image thumbnails. In addition, it displ The HTML that presents the interface looks like this: ```html - + Select some files

    No files selected!

    @@ -254,15 +298,19 @@ The `handleFiles()` method follows: window.URL = window.URL || window.webkitURL; var fileSelect = document.getElementById("fileSelect"), - fileElem = document.getElementById("fileElem"), - fileList = document.getElementById("fileList"); - -fileSelect.addEventListener("click", function (e) { - if (fileElem) { - fileElem.click(); - } - e.preventDefault(); // prevent navigation to "#" -}, false); + fileElem = document.getElementById("fileElem"), + fileList = document.getElementById("fileList"); + +fileSelect.addEventListener( + "click", + function (e) { + if (fileElem) { + fileElem.click(); + } + e.preventDefault(); // prevent navigation to "#" + }, + false, +); function handleFiles(files) { if (!files.length) { @@ -276,9 +324,9 @@ function handleFiles(files) { var img = document.createElement("img"); img.src = window.URL.createObjectURL(files[i]); img.height = 60; - img.onload = function(e) { + img.onload = function (e) { window.URL.revokeObjectURL(this.src); - } + }; li.appendChild(img); var info = document.createElement("span"); @@ -298,12 +346,12 @@ If the {{ domxref("FileList") }} object passed to `handleFiles()` is `null`, we 2. The new list element is inserted into the {{ HTMLElement("div") }} block by calling its {{ domxref("element.appendChild()") }} method. 3. For each {{ domxref("File") }} in the {{ domxref("FileList") }} represented by `files`: - 1. Create a new list item ({{ HTMLElement("li") }}) element and insert it into the list. - 2. Create a new image ({{ HTMLElement("img") }}) element. - 3. Set the image's source to a new object URL representing the file, using {{ domxref("window.URL.createObjectURL()") }} to create the blob URL. - 4. Set the image's height to 60 pixels. - 5. Set up the image's load event handler to release the object URL, since it's no longer needed once the image has been loaded. This is done by calling the {{ domxref("window.URL.revokeObjectURL()") }} method, passing in the object URL string as specified by `img.src`. - 6. Append the new list item to the list. + 1. Create a new list item ({{ HTMLElement("li") }}) element and insert it into the list. + 2. Create a new image ({{ HTMLElement("img") }}) element. + 3. Set the image's source to a new object URL representing the file, using {{ domxref("window.URL.createObjectURL()") }} to create the blob URL. + 4. Set the image's height to 60 pixels. + 5. Set up the image's load event handler to release the object URL, since it's no longer needed once the image has been loaded. This is done by calling the {{ domxref("window.URL.revokeObjectURL()") }} method, passing in the object URL string as specified by `img.src`. + 6. Append the new list item to the list. ## Example: Uploading a user-selected file @@ -337,21 +385,32 @@ function FileUpload(img, file) { this.xhr = xhr; var self = this; - this.xhr.upload.addEventListener("progress", function(e) { - if (e.lengthComputable) { - var percentage = Math.round((e.loaded * 100) / e.total); - self.ctrl.update(percentage); - } - }, false); - - xhr.upload.addEventListener("load", function(e){ - self.ctrl.update(100); - var canvas = self.ctrl.ctx.canvas; - canvas.parentNode.removeChild(canvas); - }, false); - xhr.open("POST", "http://demos.hacks.mozilla.org/paul/demos/resources/webservices/devnull.php"); - xhr.overrideMimeType('text/plain; charset=x-user-defined-binary'); - reader.onload = function(evt) { + this.xhr.upload.addEventListener( + "progress", + function (e) { + if (e.lengthComputable) { + var percentage = Math.round((e.loaded * 100) / e.total); + self.ctrl.update(percentage); + } + }, + false, + ); + + xhr.upload.addEventListener( + "load", + function (e) { + self.ctrl.update(100); + var canvas = self.ctrl.ctx.canvas; + canvas.parentNode.removeChild(canvas); + }, + false, + ); + xhr.open( + "POST", + "http://demos.hacks.mozilla.org/paul/demos/resources/webservices/devnull.php", + ); + xhr.overrideMimeType("text/plain; charset=x-user-defined-binary"); + reader.onload = function (evt) { xhr.sendAsBinary(evt.target.result); }; reader.readAsBinaryString(file); @@ -371,59 +430,61 @@ Before actually transferring the data, several preparatory steps are taken: ### Handling the upload process for a file, asynchronously -```js +```php +?> + - + dnd binary upload - - + dropzone.ondrop = function(event) { + event.stopPropagation(); + event.preventDefault(); + + var filesArray = event.dataTransfer.files; + for (var i=0; i + +
    -
    Drag & drop your file here...
    +
    Drag & drop your file here...
    - + ``` diff --git a/files/pt-br/web/api/filelist/index.md b/files/pt-br/web/api/filelist/index.md index 692ffee3927d3b..24ee14afdb7bc7 100644 --- a/files/pt-br/web/api/filelist/index.md +++ b/files/pt-br/web/api/filelist/index.md @@ -20,7 +20,7 @@ Todo elemento `` possui um array `files` que permite o acesso aos seus ar O código a seguir acessa o primeiro elemento da lista de arquivos como um objeto [`File`](/pt-BR/docs/DOM/File): ```js -var file = document.getElementById('fileItem').files[0]; +var file = document.getElementById("fileItem").files[0]; ``` ## Visão geral dos métodos @@ -69,50 +69,49 @@ var file; // percorre os arquivos for (var i = 0; i < files.length; i++) { + // obtém o item + file = files.item(i); + // ou + file = files[i]; - // obtém o item - file = files.item(i); - // ou - file = files[i]; - - alert(file.name); + alert(file.name); } ``` A seguir, um exemplo completo. ```html - + + - - - - - + + - + + - + + } + }; + // seta o 'onchange' do elemento input para chamar a função puxarArquivos + document.querySelector("#myfiles").onchange = puxarArquivos; + ``` -## Especificação +## Especificações + +{{Specifications}} + +## Compatibilidade com navegadores -- [File upload state](http://www.whatwg.org/specs/web-apps/current-work/multipage/number-state.html#concept-input-type-file-selected) (inglês) +{{Compat}} diff --git a/files/pt-br/web/api/filereader/filereader/index.md b/files/pt-br/web/api/filereader/filereader/index.md index 7bcbf575364470..ac2354836d3100 100644 --- a/files/pt-br/web/api/filereader/filereader/index.md +++ b/files/pt-br/web/api/filereader/filereader/index.md @@ -24,7 +24,7 @@ O seguinte trecho de código ilustra a criação de um objeto [`FileReader`](/pt ```js function printFile(file) { var reader = new FileReader(); - reader.onload = function(evt) { + reader.onload = function (evt) { console.log(evt.target.result); }; reader.readAsText(file); @@ -33,9 +33,11 @@ function printFile(file) { ## Especificações -| Especificação | Status | Comentário | -| -------------------------------- | ---------------------------- | ------------------ | -| {{SpecName('File API')}} | {{Spec2('File API')}} | Initial definition | +{{Specifications}} + +## Compatibilidade com navegadores + +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/filereader/index.md b/files/pt-br/web/api/filereader/index.md index e3bbb1bc91bb1e..05a6e2a8b294b7 100644 --- a/files/pt-br/web/api/filereader/index.md +++ b/files/pt-br/web/api/filereader/index.md @@ -145,13 +145,11 @@ Veja [Using files from web applications](/pt-BR/Using_files_from_web_application ## Especificações -| Especificação | Status | Comentário | -| -------------------------------------------------------------------------------- | ---------------------------- | ------------------ | -| {{SpecName('File API','#FileReader-interface','FileReader')}} | {{Spec2('File API')}} | Definição inicial. | +{{Specifications}} -## Compatibilidade +## Compatibilidade com navegadores -{{Compat("api.FileReader")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/filereader/load_event/index.md b/files/pt-br/web/api/filereader/load_event/index.md index 2b0268b2e33f36..0d21dd29e71a3d 100644 --- a/files/pt-br/web/api/filereader/load_event/index.md +++ b/files/pt-br/web/api/filereader/load_event/index.md @@ -15,9 +15,9 @@ A propriedade **FileReader.onload** contém um manipulador de eventos (event han function onChange(event) { var file = event.target.files[0]; var reader = new FileReader(); - reader.onload = function(event) { + reader.onload = function (event) { // O arquivo de texto será impresso aqui - console.log(event.target.result) + console.log(event.target.result); }; reader.readAsText(file); diff --git a/files/pt-br/web/api/filereader/readasarraybuffer/index.md b/files/pt-br/web/api/filereader/readasarraybuffer/index.md index d79ccb3d2fbf17..8a429c1a124427 100644 --- a/files/pt-br/web/api/filereader/readasarraybuffer/index.md +++ b/files/pt-br/web/api/filereader/readasarraybuffer/index.md @@ -20,13 +20,11 @@ instanceOfFileReader.readAsArrayBuffer(blob); ## Especificações -| Especificação | Status | Comentário | -| -------------------------------------------------------------------------------------------------------- | ---------------------------- | ----------------- | -| {{SpecName("File API", "#readAsArrayBuffer", "FileReader.readAsArrayBuffer")}} | {{Spec2("File API")}} | Definição Inicial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FileReader.readAsArrayBuffer")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/filereader/readasbinarystring/index.md b/files/pt-br/web/api/filereader/readasbinarystring/index.md index b72495ad569f88..e0349dccc191ba 100644 --- a/files/pt-br/web/api/filereader/readasbinarystring/index.md +++ b/files/pt-br/web/api/filereader/readasbinarystring/index.md @@ -23,18 +23,18 @@ instanciaDeFileReader.readAsBinaryString(blob); ## Exemplo ```js -var canvas = document.createElement('canvas'); +var canvas = document.createElement("canvas"); var height = 200; -var width = 200; +var width = 200; -canvas.width = width; +canvas.width = width; canvas.height = height; -var ctx = canvas.getContext('2d'); +var ctx = canvas.getContext("2d"); -ctx.strokeStyle = '#090'; +ctx.strokeStyle = "#090"; ctx.beginPath(); -ctx.arc(width/2, height/2, width/2 - width/10, 0, Math.PI*2); +ctx.arc(width / 2, height / 2, width / 2 - width / 10, 0, Math.PI * 2); ctx.stroke(); canvas.toBlob(function (blob) { @@ -42,7 +42,7 @@ canvas.toBlob(function (blob) { reader.onloadend = function () { console.log(reader.result); - } + }; reader.readAsBinaryString(blob); }); @@ -50,11 +50,11 @@ canvas.toBlob(function (blob) { ## Especificações -Este método foi removido dos padrões FileAPI {{domxref("FileReader.readAsArrayBuffer()")}} deve ser usado no lugar dele. +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FileReader.readAsBinaryString")}} +{{Compat}} ## Veja Também diff --git a/files/pt-br/web/api/filereader/readastext/index.md b/files/pt-br/web/api/filereader/readastext/index.md index a2023fd8d65b94..2c99897076ccc8 100644 --- a/files/pt-br/web/api/filereader/readastext/index.md +++ b/files/pt-br/web/api/filereader/readastext/index.md @@ -22,13 +22,11 @@ instanceOfFileReader.readAsText(blob[, encoding]); ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------ | ---------------------------- | ----------------- | -| {{SpecName("File API", "#FileReader-interface", "FileReader")}} | {{Spec2("File API")}} | Definição inicial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FileReader.readAsText")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/formdata/append/index.md b/files/pt-br/web/api/formdata/append/index.md index c06a3e12ada392..207707a3255032 100644 --- a/files/pt-br/web/api/formdata/append/index.md +++ b/files/pt-br/web/api/formdata/append/index.md @@ -46,19 +46,17 @@ var formData = new FormData(); // Corrente vazio Podes adicionar chaves/valores pares para usar (domxref("FormData.append")}}: ```js -formData.append('username', 'Chris'); -formData.append('userpic', myFileInput.files[0], 'chris.jpg'); +formData.append("username", "Chris"); +formData.append("userpic", myFileInput.files[0], "chris.jpg"); ``` ## Especificações -| Especificações | Estato | Comentario | -| ------------------------------------------------------------------------------------ | ------------------------ | ---------- | -| {{SpecName('XMLHttpRequest','#dom-formdata-append','append()')}} | {{Spec2('Fetch')}} | | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FormData.append")}} +{{Compat}} ## Veja Tambem diff --git a/files/pt-br/web/api/formdata/delete/index.md b/files/pt-br/web/api/formdata/delete/index.md index e170acf6ad15b9..17e5875cb995b1 100644 --- a/files/pt-br/web/api/formdata/delete/index.md +++ b/files/pt-br/web/api/formdata/delete/index.md @@ -35,18 +35,16 @@ var formData = new FormData(myForm); Podes deletar chave/valor pares usando `delete()`: ```js -formData.delete('username'); +formData.delete("username"); ``` -## Specificasões +## Especificações -| Specificasões | Status | Comment | -| ------------------------------------------------------------------------------------ | ------------------------------------ | ------- | -| {{SpecName('XMLHttpRequest','#dom-formdata-delete','delete()')}} | {{Spec2('XMLHttpRequest')}} | | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FormData.delete")}} +{{Compat}} ## Veja Tambem diff --git a/files/pt-br/web/api/formdata/entries/index.md b/files/pt-br/web/api/formdata/entries/index.md index 28592133db627e..d944fb7d5a3f9f 100644 --- a/files/pt-br/web/api/formdata/entries/index.md +++ b/files/pt-br/web/api/formdata/entries/index.md @@ -24,12 +24,12 @@ Retorna um {{jsxref("Iteration_protocols","iterator")}}. ```js // Criação de um objeto teste de FormData var formData = new FormData(); -formData.append('key1', 'value1'); -formData.append('key2', 'value2'); +formData.append("key1", "value1"); +formData.append("key2", "value2"); // Exibição dos valores chave/valor -for(var pair of formData.entries()) { - console.log(pair[0]+ ', '+ pair[1]); +for (var pair of formData.entries()) { + console.log(pair[0] + ", " + pair[1]); } ``` @@ -42,13 +42,11 @@ key2, value2 ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------------------------------ | ------------------------------------ | ------------------ | -| {{SpecName('XMLHttpRequest','#dom-formdata','entries() (as iterator<>)')}} | {{Spec2('XMLHttpRequest')}} | Initial definition | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FormData.entries")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/formdata/formdata/index.md b/files/pt-br/web/api/formdata/formdata/index.md index c1fec38e823838..f3b28b84b818ac 100644 --- a/files/pt-br/web/api/formdata/formdata/index.md +++ b/files/pt-br/web/api/formdata/formdata/index.md @@ -12,7 +12,7 @@ O **`FormData()`** construtor cria um novo objeto {{domxref("FormData")}}. ## Sintaxe ```js -var formData = new FormData(form) +var formData = new FormData(form); ``` ### Parâmetros @@ -31,7 +31,7 @@ var formData = new FormData(); // Currently empty Você poderia adicionar uma chave/valor usando {{domxref("FormData.append")}}: ```js -formData.append('username', 'Chris'); +formData.append("username", "Chris"); ``` Ou você pode especificicar o opcional `form` argument ao criar o objeto `FormData`, para o popular com valores de forma especifica: @@ -40,36 +40,34 @@ Ou você pode especificicar o opcional `form` argument ao criar o objeto `FormDa
    - +
    - +
    - +
    - +
    ``` > **Nota:** Todos os elementos de entrada têm um atributo 'name'. Para que possa acessar seus valores mais tarde. ```js -var myForm = document.getElementById('myForm'); +var myForm = document.getElementById("myForm"); formData = new FormData(myForm); ``` ## Especificações -| Especificação | Status | Comentário | -| -------------------------------------------------------------------------------- | ------------------------------------ | ----------------- | -| {{SpecName('XMLHttpRequest','#dom-formdata','FormData()')}} | {{Spec2('XMLHttpRequest')}} | Definição inicial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FormData.FormData")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/formdata/get/index.md b/files/pt-br/web/api/formdata/get/index.md index b636e7d917ba1a..5bbfcf6c434b10 100644 --- a/files/pt-br/web/api/formdata/get/index.md +++ b/files/pt-br/web/api/formdata/get/index.md @@ -35,25 +35,23 @@ var formData = new FormData(); Se adicionarmos dois valores usuario_nome usando {{domxref("FormData.append")}}: ```js -formData.append('usuario_nome', 'Sabrina'); -formData.append('usuario_nome', 'Antônio'); +formData.append("usuario_nome", "Sabrina"); +formData.append("usuario_nome", "Antônio"); ``` A função get() abaixo apenas irá retornar o primeiro valor usuario_nome incluido: ```js -formData.get('usuario_nome'); // Retorna "Sabrina" +formData.get("usuario_nome"); // Retorna "Sabrina" ``` ## Especificações -| Especificação | Status | Comentário | -| ---------------------------------------------------------------------------- | ------------------------------------ | ---------- | -| {{SpecName('XMLHttpRequest','#dom-formdata-get','get()')}} | {{Spec2('XMLHttpRequest')}} | | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FormData.get")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/formdata/getall/index.md b/files/pt-br/web/api/formdata/getall/index.md index c0b131e85c643d..aa2c99022e0a26 100644 --- a/files/pt-br/web/api/formdata/getall/index.md +++ b/files/pt-br/web/api/formdata/getall/index.md @@ -35,25 +35,23 @@ var formData = new FormData(); Se nos adicionarmos dois valores oara `username` {{domxref("FormData.append")}}: ```js -formData.append('username', 'Chris'); -formData.append('username', 'Bob'); +formData.append("username", "Chris"); +formData.append("username", "Bob"); ``` A seguinte função `getAll()` retornara um array com os valores dentro de `username`: ```js -formData.getAll('username'); // Returns ["Chris", "Bob"] +formData.getAll("username"); // Returns ["Chris", "Bob"] ``` -## Especificação +## Especificações -| Specification | Status | Comment | -| ------------------------------------------------------------------------------------ | ------------------------------------ | ------- | -| {{SpecName('XMLHttpRequest','#dom-formdata-getall','getAll()')}} | {{Spec2('XMLHttpRequest')}} | | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FormData.getAll")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/formdata/has/index.md b/files/pt-br/web/api/formdata/has/index.md index 5d6cc015e68340..0bc241641c84e7 100644 --- a/files/pt-br/web/api/formdata/has/index.md +++ b/files/pt-br/web/api/formdata/has/index.md @@ -35,20 +35,18 @@ var formData = new FormData(); O trecho a seguir mostra os resultados de testar a existência de `username` no objeto `FormData`, antes e depois de acrescentar um valor de `username` no objeto usando {{domxref("FormData.append")}}: ```js -formData.has('username'); // Retorna false -formData.append('username', 'Chris'); -formData.has('username'); // Retorna true +formData.has("username"); // Retorna false +formData.append("username", "Chris"); +formData.has("username"); // Retorna true ``` ## Especificações -| Especificação | Status | Comentário | -| ---------------------------------------------------------------------------- | ------------------------------------ | ---------- | -| {{SpecName('XMLHttpRequest','#dom-formdata-has','has()')}} | {{Spec2('XMLHttpRequest')}} | | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FormData.has")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/formdata/index.md b/files/pt-br/web/api/formdata/index.md index 00ef77617d91dc..811cff5535c23a 100644 --- a/files/pt-br/web/api/formdata/index.md +++ b/files/pt-br/web/api/formdata/index.md @@ -35,13 +35,11 @@ Um objeto `FormData` pode ser usado diretamente em uma estrutura {{jsxref("State ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------ | ------------------------------------ | -------------------------------------- | -| {{SpecName('XMLHttpRequest','#interface-formdata','FormData')}} | {{Spec2('XMLHttpRequest')}} | FormData definido na especificação XHR | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FormData")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/formdata/set/index.md b/files/pt-br/web/api/formdata/set/index.md index e3cdd0ebdcdedb..76f370fe91c196 100644 --- a/files/pt-br/web/api/formdata/set/index.md +++ b/files/pt-br/web/api/formdata/set/index.md @@ -42,19 +42,17 @@ var formData = new FormData(); // Currently empty Você pode adicionar os pares chave/valor usando (domxref("FormData.set")}}: ```js -formData.set('username', 'Chris'); -formData.set('userpic', myFileInput.files[0], 'chris.jpg'); +formData.set("username", "Chris"); +formData.set("userpic", myFileInput.files[0], "chris.jpg"); ``` ## Especificações -| Especificação | Status | Comentário | -| ---------------------------------------------------------------------------- | ------------------------------------ | ---------- | -| {{SpecName('XMLHttpRequest','#dom-formdata-set','set()')}} | {{Spec2('XMLHttpRequest')}} | | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.FormData.set")}} +{{Compat}} ## Ver também diff --git a/files/pt-br/web/api/gamepad_api/index.md b/files/pt-br/web/api/gamepad_api/index.md index e113f937138202..7cf643b5aa55c9 100644 --- a/files/pt-br/web/api/gamepad_api/index.md +++ b/files/pt-br/web/api/gamepad_api/index.md @@ -46,14 +46,11 @@ Veja também as [extensões para a interface de Gamepad](/pt-BR/docs/Web/API/Gam ## Especificações -| Especificações | Estatus | Comentários | -| -------------------------------------------------------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------------- | -| {{SpecName("GamepadExtensions")}} | {{Spec2("GamepadExtensions")}} | Defines the [Experimental Gamepad extensions](#experimental_gamepad_extensions). | -| {{SpecName("Gamepad", "", "The Gamepad API specification")}} | {{Spec2("Gamepad")}} | Initial definition | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Gamepad")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/geolocation/clearwatch/index.md b/files/pt-br/web/api/geolocation/clearwatch/index.md index fa50de367fcbc5..b4c6663877d3cb 100644 --- a/files/pt-br/web/api/geolocation/clearwatch/index.md +++ b/files/pt-br/web/api/geolocation/clearwatch/index.md @@ -27,24 +27,24 @@ function success(pos) { var crd = pos.coords; if (target.latitude === crd.latitude && target.longitude === crd.longitude) { - console.log('Congratulation, you reach the target'); + console.log("Congratulation, you reach the target"); navigator.geolocation.clearWatch(id); } -}; +} function error(err) { - console.warn('ERROR(' + err.code + '): ' + err.message); -}; + console.warn("ERROR(" + err.code + "): " + err.message); +} target = { - latitude : 0, + latitude: 0, longitude: 0, -} +}; options = { enableHighAccuracy: false, timeout: 5000, - maximumAge: 0 + maximumAge: 0, }; id = navigator.geolocation.watchPosition(success, error, options); @@ -52,13 +52,11 @@ id = navigator.geolocation.watchPosition(success, error, options); ## Especificações -| Specification | Status | Comment | -| ------------------------------------ | -------------------------------- | ---------------------- | -| {{SpecName('Geolocation')}} | {{Spec2('Geolocation')}} | Initial specification. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Geolocation.clearWatch")}} +{{Compat}} ## Veja Também diff --git a/files/pt-br/web/api/geolocation/getcurrentposition/index.md b/files/pt-br/web/api/geolocation/getcurrentposition/index.md index f46d5091fec80c..c212ce63055d81 100644 --- a/files/pt-br/web/api/geolocation/getcurrentposition/index.md +++ b/files/pt-br/web/api/geolocation/getcurrentposition/index.md @@ -28,34 +28,32 @@ navigator.geolocation.getCurrentPosition(success, error, options) var options = { enableHighAccuracy: true, timeout: 5000, - maximumAge: 0 + maximumAge: 0, }; function success(pos) { var crd = pos.coords; - console.log('Sua posição atual é:'); - console.log('Latitude : ' + crd.latitude); - console.log('Longitude: ' + crd.longitude); - console.log('Mais ou menos ' + crd.accuracy + ' metros.'); -}; + console.log("Sua posição atual é:"); + console.log("Latitude : " + crd.latitude); + console.log("Longitude: " + crd.longitude); + console.log("Mais ou menos " + crd.accuracy + " metros."); +} function error(err) { - console.warn('ERROR(' + err.code + '): ' + err.message); -}; + console.warn("ERROR(" + err.code + "): " + err.message); +} navigator.geolocation.getCurrentPosition(success, error, options); ``` ## Especificações -| Especificação | Estado | Comentário | -| ------------------------------------ | -------------------------------- | ---------------------- | -| {{SpecName('Geolocation')}} | {{Spec2('Geolocation')}} | Especificação inicial. | +{{Specifications}} -## Navegadores compatíveis +## Compatibilidade com navegadores -{{Compat("api.Geolocation.getCurrentPosition")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/geolocation/index.md b/files/pt-br/web/api/geolocation/index.md index 378848ab2821a2..a70a02a2fe7e02 100644 --- a/files/pt-br/web/api/geolocation/index.md +++ b/files/pt-br/web/api/geolocation/index.md @@ -28,13 +28,11 @@ _A interface_ Geolocation _não herda qualquer métodos._ ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------ | -------------------------------- | --------------------- | -| {{SpecName('Geolocation')}} | {{Spec2('Geolocation')}} | Especificação Inicial | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.Geolocation")}} +{{Compat}} ## Veja Também diff --git a/files/pt-br/web/api/geolocation/watchposition/index.md b/files/pt-br/web/api/geolocation/watchposition/index.md index 31412063f811c6..ac3aaec14a0c5c 100644 --- a/files/pt-br/web/api/geolocation/watchposition/index.md +++ b/files/pt-br/web/api/geolocation/watchposition/index.md @@ -35,24 +35,24 @@ function success(pos) { var crd = pos.coords; if (target.latitude === crd.latitude && target.longitude === crd.longitude) { - console.log('Parabéns, você alcançou o destino'); + console.log("Parabéns, você alcançou o destino"); navigator.geolocation.clearWatch(id); } } function error(err) { - console.warn('ERRO(' + err.code + '): ' + err.message); + console.warn("ERRO(" + err.code + "): " + err.message); } target = { - latitude : 0, - longitude: 0 + latitude: 0, + longitude: 0, }; options = { enableHighAccuracy: false, timeout: 5000, - maximumAge: 0 + maximumAge: 0, }; id = navigator.geolocation.watchPosition(success, error, options); @@ -60,13 +60,11 @@ id = navigator.geolocation.watchPosition(success, error, options); ## Especificações -| Especificação | Estado | Comentário | -| -------------------------------------------------------------------------------------------------------- | -------------------------------- | ---------------------- | -| {{SpecName('Geolocation', '#watch-position', 'Geolocation.watchPosition()')}} | {{Spec2('Geolocation')}} | Especificação Inicial. | +{{Specifications}} -## Compatibillidade de Navegadores +## Compatibilidade com navegadores -{{Compat("api.Geolocation.watchPosition")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/geolocation_api/index.md b/files/pt-br/web/api/geolocation_api/index.md index 6ab4086862f748..af94ebfd054138 100644 --- a/files/pt-br/web/api/geolocation_api/index.md +++ b/files/pt-br/web/api/geolocation_api/index.md @@ -14,15 +14,18 @@ O aplicativo de geolocalização é utilizado através de um objeto filho chamad if ("geolocation" in navigator) { /* geolocation is available */ } else { - alert("I'm sorry, but geolocation services are not supported by your browser."); + alert( + "I'm sorry, but geolocation services are not supported by your browser.", + ); } ``` Ao iniciar no Gecko 1.9.2 (Firefox 3.6), add-ons podem obter o objeto de geolocalização obtendo a referência para o serviço de geolocaliazação como se ve a seguir: ```js -var geolocation = Components.classes["@mozilla.org/geolocation;1"] - .getService(Components.interfaces.nsIDOMGeoGeolocation); +var geolocation = Components.classes["@mozilla.org/geolocation;1"].getService( + Components.interfaces.nsIDOMGeoGeolocation, +); ``` ### Obtendo a posição atual @@ -32,7 +35,7 @@ Para obter a localização atual do usuário, você pode utiliza o método `getC Use `getCurrentPosition()` se você deseja uma única posição rapidamente, independente da precisão. Dispositivos com GPS, por exemplo, podem levar um minuto ou mais para conseguir a localização, e portanto dados menos precisos (localização do IP location ou rede wifi) podem retornar do método `getCurrentPosition()`. ```js -navigator.geolocation.getCurrentPosition(function(position) { +navigator.geolocation.getCurrentPosition(function (position) { do_something(position.coords.latitude, position.coords.longitude); }); ``` @@ -46,10 +49,9 @@ Se os dados de posição mudam (sejam pelo movimento do dispositivo ou se uma in O `watchPosition()` pode ser usado sem que não haja a chamada inicial de `getCurrentPosition()`. ```js -var watchID = navigator.geolocation.watchPosition(function(position) { +var watchID = navigator.geolocation.watchPosition(function (position) { do_something(position.coords.latitude, position.coords.longitude); -} -); +}); ``` O método `watchPosition()` retorna um número de ID que pode ser usado para identificar a `posição` solicitada; você pode usar esse valor em conjunto com o método `clearWatch()`, parando a localização do usuário. @@ -121,67 +123,75 @@ Qualquer add-on hospedado em addons.mozilla.org, que faz uso de dados de geoloca ```js function prompt(window, pref, message, callback) { - let branch = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefBranch); - - if (branch.getPrefType(pref) === branch.PREF_STRING) { - switch (branch.getCharPref(pref)) { - case "always": - return callback(true); - case "never": - return callback(false); - } + let branch = Components.classes[ + "@mozilla.org/preferences-service;1" + ].getService(Components.interfaces.nsIPrefBranch); + + if (branch.getPrefType(pref) === branch.PREF_STRING) { + switch (branch.getCharPref(pref)) { + case "always": + return callback(true); + case "never": + return callback(false); } - - let done = false; - - function remember(value, result) { - return function() { - done = true; - branch.setCharPref(pref, value); - callback(result); + } + + let done = false; + + function remember(value, result) { + return function () { + done = true; + branch.setCharPref(pref, value); + callback(result); + }; + } + + let self = window.PopupNotifications.show( + window.gBrowser.selectedBrowser, + "geolocation", + message, + "geo-notification-icon", + { + label: "Share Location", + accessKey: "S", + callback: function (notification) { + done = true; + callback(true); + }, + }, + [ + { + label: "Always Share", + accessKey: "A", + callback: remember("always", true), + }, + { + label: "Never Share", + accessKey: "N", + callback: remember("never", false), + }, + ], + { + eventCallback: function (event) { + if (event === "dismissed") { + if (!done) callback(false); + done = true; + window.PopupNotifications.remove(self); } - } - - let self = window.PopupNotifications.show( - window.gBrowser.selectedBrowser, - "geolocation", - message, - "geo-notification-icon", - { - label: "Share Location", - accessKey: "S", - callback: function(notification) { - done = true; - callback(true); - } - }, [ - { - label: "Always Share", - accessKey: "A", - callback: remember("always", true) - }, - { - label: "Never Share", - accessKey: "N", - callback: remember("never", false) - } - ], { - eventCallback: function(event) { - if (event === "dismissed") { - if (!done) callback(false); - done = true; - window.PopupNotifications.remove(self); - } - }, - persistWhileVisible: true - }); + }, + persistWhileVisible: true, + }, + ); } -prompt(window, - "extensions.foo-addon.allowGeolocation", - "Foo Add-on wants to know your location.", - function callback(allowed) { alert(allowed); }); +prompt( + window, + "extensions.foo-addon.allowGeolocation", + "Foo Add-on wants to know your location.", + function callback(allowed) { + alert(allowed); + }, +); ``` ## Veja também diff --git a/files/pt-br/web/api/geolocationcoordinates/altitude/index.md b/files/pt-br/web/api/geolocationcoordinates/altitude/index.md index 65bc078cc1759d..5b303f9a164af2 100644 --- a/files/pt-br/web/api/geolocationcoordinates/altitude/index.md +++ b/files/pt-br/web/api/geolocationcoordinates/altitude/index.md @@ -15,9 +15,7 @@ alt = coordinates.altitude ## Especificações -| Specification | Status | Comment | -| ------------------------------------------------------------------------------------ | -------------------------------- | ------------------ | -| {{SpecName('Geolocation', '#altitude', 'Coordinates.altitude')}} | {{Spec2('Geolocation')}} | Initial definition | +{{Specifications}} ## Compatibilidade com navegadores diff --git a/files/pt-br/web/api/geolocationcoordinates/index.md b/files/pt-br/web/api/geolocationcoordinates/index.md index ae0021601bb1d2..5afa15401daf94 100644 --- a/files/pt-br/web/api/geolocationcoordinates/index.md +++ b/files/pt-br/web/api/geolocationcoordinates/index.md @@ -30,15 +30,13 @@ _A interface do `Coordinates` não herda nenhuma propiedade_. **A interface da `Coordinates` _não implementa, nem herda nenhum método._** -## Specifications +## Especificações -| Specification | Status | Comment | -| ---------------------------------------------------------------------------- | -------------------------------- | ---------------------- | -| {{SpecName('Geolocation', '#coordinates', 'Coordinates')}} | {{Spec2('Geolocation')}} | Especificação inicial. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.GeolocationCoordinates")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/geolocationposition/coords/index.md b/files/pt-br/web/api/geolocationposition/coords/index.md index 6baca65b8eabe5..54695a5b4e157c 100644 --- a/files/pt-br/web/api/geolocationposition/coords/index.md +++ b/files/pt-br/web/api/geolocationposition/coords/index.md @@ -15,13 +15,11 @@ coord = position.coords ## Especificações -| Especificação | Status | Comentário | -| ---------------------------------------------------------------------------- | -------------------------------- | ---------------------- | -| {{SpecName('Geolocation', '#coords', 'Position.coords')}} | {{Spec2('Geolocation')}} | Especificação inicial. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.GeolocationPosition.coords")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/geolocationposition/index.md b/files/pt-br/web/api/geolocationposition/index.md index df862097b2611a..cfca6e36782192 100644 --- a/files/pt-br/web/api/geolocationposition/index.md +++ b/files/pt-br/web/api/geolocationposition/index.md @@ -22,9 +22,7 @@ _A interface `Position` não herda nenhuma propriedade_. ## Especificações -| Especificação | Status | Comentário | -| -------------------------------------------------------------------- | -------------------------------- | ---------------------- | -| {{SpecName('Geolocation', '#position', 'Position')}} | {{Spec2('Geolocation')}} | Especificação inicial. | +{{Specifications}} ## Compatibilidade com navegadores diff --git a/files/pt-br/web/api/geolocationpositionerror/index.md b/files/pt-br/web/api/geolocationpositionerror/index.md index 2a8138e4e20f11..455f4646b2c4f0 100644 --- a/files/pt-br/web/api/geolocationpositionerror/index.md +++ b/files/pt-br/web/api/geolocationpositionerror/index.md @@ -15,10 +15,10 @@ _A interface `PositionError` não herda nenhuma propriedade_. - : Retorna um tipo `unsigned short` representando o código de erro. Os valores possíveis são os seguintes: - | Valor | Constante associada | Descrição | - | ----- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | `1` | `PERMISSION_DENIED` | Não foi possível obter a informação sobre geolocalização por que a página não possuía permissão para fazê-lo. | - | `2` | `POSITION_UNAVAILABLE` | A obtenção da geolocalização falhou por que pelo menos uma fonte interna de posicionamento retornou um erro interno. | + | Valor | Constante associada | Descrição | + | ----- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | + | `1` | `PERMISSION_DENIED` | Não foi possível obter a informação sobre geolocalização por que a página não possuía permissão para fazê-lo. | + | `2` | `POSITION_UNAVAILABLE` | A obtenção da geolocalização falhou por que pelo menos uma fonte interna de posicionamento retornou um erro interno. | | `3` | `TIMEOUT` | O tempo máximo permitido para obter a geolocalização, definido por {{domxref("PositionOptions.timeout")}} foi atingido antes de se obter a informação. | - {{domxref("PositionError.message")}} {{readonlyInline}} @@ -30,13 +30,11 @@ _A interface `PositionError` não herda nenhuma propriedade_. ## Especificações -| Especificação | Status | Comentário | -| ------------------------------------------------------------------------------------ | -------------------------------- | ---------------------- | -| {{SpecName('Geolocation', '#positionerror', 'PositionError')}} | {{Spec2('Geolocation')}} | Especificação inicial. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.GeolocationPositionError")}} +{{Compat}} ## Veja também diff --git a/files/pt-br/web/api/history/index.md b/files/pt-br/web/api/history/index.md index f29b576804b5b7..716765efe90bee 100644 --- a/files/pt-br/web/api/history/index.md +++ b/files/pt-br/web/api/history/index.md @@ -47,17 +47,13 @@ _The `History`_ _interface doesn't inherit any methods._ - {{domxref("History.replaceState()")}} - : Updates the most recent entry on the history stack to have the specified data, title, and, if provided, URL. The data is treated as opaque by the DOM; you may specify any JavaScript object that can be serialized. Note that Firefox currently ignores the title parameter; for more information, see [manipulating the browser history](/pt-BR/docs/Web/API/History_API). -## Specifications +## Especificações -| Specification | Status | Comment | -| -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | --------------------------------------- | -| {{SpecName('HTML WHATWG', "browsers.html#the-history-interface", "History")}} | {{Spec2('HTML WHATWG')}} | Adds the `scrollRestoration` attribute. | -| {{SpecName('HTML5 W3C', "browsers.html#the-history-interface", "History")}} | {{Spec2('HTML5 W3C')}} | Initial definition. | -| {{SpecName('Custom Scroll Restoration', '#web-idl', "History")}} | {{Spec2('Custom Scroll Restoration')}} | Adds the `scrollRestoration` attribute. | +{{Specifications}} ## Compatibilidade com navegadores -{{Compat("api.History")}} +{{Compat}} ## See also