Skip to content

Commit 8236117

Browse files
committed
Element-only navigation translated
1 parent d0a9ba4 commit 8236117

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

2-ui/1-document/03-dom-navigation/article.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -208,60 +208,60 @@ Por exemplo:
208208
</script></body></html>
209209
```
210210

211-
## Element-only navigation
211+
## Navegação apenas por elementos
212212

213-
Navigation properties listed above refer to *all* nodes. For instance, in `childNodes` we can see both text nodes, element nodes, and even comment nodes if there exist.
213+
As propriedades de navegação listadas acima se referem a *todos* os nós. Por exemplo, em `childNodes`, podemos ver nós de textos, nós de elementos e até nós de comentários, se existirem.
214214

215-
But for many tasks we don't want text or comment nodes. We want to manipulate element nodes that represent tags and form the structure of the page.
215+
Mas, para muitas tarefas, não queremos nós de textos ou comentários. Queremos manipular nós de elementos que formam a estrutura da página.
216216

217-
So let's see more navigation links that only take *element nodes* into account:
217+
Então, vamos ver mais interligações de navegação que consideram apenas *nós de elementos*:
218218

219219
![](dom-links-elements.svg)
220220

221-
The links are similar to those given above, just with `Element` word inside:
221+
As interligações são semelhantes às apresentadas acima, acrescentando apenas a palavra `Element`:
222222

223-
- `children` -- only those children that are element nodes.
224-
- `firstElementChild`, `lastElementChild` -- first and last element children.
225-
- `previousElementSibling`, `nextElementSibling` -- neighbour elements.
226-
- `parentElement` -- parent element.
223+
- `children` -- somente os nós que são filhos do elemento.
224+
- `firstElementChild`, `lastElementChild` -- primeiro e último elemento filho.
225+
- `previousElementSibling`, `nextElementSibling` -- elementos vizinhos.
226+
- `parentElement` -- elemento pai.
227227

228-
````smart header="Why `parentElement`? Can the parent be *not* an element?"
229-
The `parentElement` property returns the "element" parent, while `parentNode` returns "any node" parent. These properties are usually the same: they both get the parent.
228+
````smart header="Por que `parentElement`? O pai *não* pode ser um elemento?"
229+
A propriedade `parentElement` retorna o "elemento" pai, enquanto `parentNode` retorna "qualquer nó" pai. Essas propriedades geralmente são as mesmas: ambas obtêm o pai.
230230

231-
With the one exception of `document.documentElement`:
231+
Com exceção do `document.documentElement`:
232232

233233
```js run
234234
alert( document.documentElement.parentNode ); // document
235235
alert( document.documentElement.parentElement ); // null
236236
```
237237

238-
In other words, the `documentElement` (`<html>`) is the root node. Formally, it has `document` as its parent. But `document` is not an element node, so `parentNode` returns it and `parentElement` does not.
238+
Em outras palavras, o `documentElement` (`<html>`) é o nó raiz. Formalmente, tem `document` como pai. Mas o `document` não é um nó de elemento, portanto, somente `parentNode` o retorna. `parentElement` não.
239239

240-
This loop travels up from an arbitrary element `elem` to `<html>`, but not to the `document`:
240+
Este laço de repetição percorre de um elemento arbitrário `elem` até `<html>`, mas não até o `document`:
241241
```js
242242
while(elem = elem.parentElement) {
243-
alert( elem ); // parent chain till <html>
243+
alert( elem ); // sequência de pais até <html>
244244
}
245245
```
246246
````
247247
248-
Let's modify one of the examples above: replace `childNodes` with `children`. Now it shows only elements:
248+
Vamos modificar um dos exemplos acima: substitua `childNodes` por `children`. Agora ele mostra apenas elementos:
249249
250250
```html run
251251
<html>
252252
<body>
253-
<div>Begin</div>
253+
<div>Início</div>
254254
255255
<ul>
256-
<li>Information</li>
256+
<li>Informação</li>
257257
</ul>
258258
259-
<div>End</div>
259+
<div>Fim</div>
260260
261261
<script>
262262
*!*
263263
for (let elem of document.body.children) {
264-
alert(elem); // DIV, UL, DIV, SCRIPT
264+
alert(elem); // div, ul, div, SCRIPT
265265
}
266266
*/!*
267267
</script>

0 commit comments

Comments
 (0)