Skip to content

Commit de41f75

Browse files
translate attributes and properties
Attributes and properties
2 parents 507d5ee + 3484cc3 commit de41f75

File tree

7 files changed

+148
-149
lines changed

7 files changed

+148
-149
lines changed

2-ui/1-document/06-dom-attributes-and-properties/1-get-user-attribute/solution.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
<html>
55
<body>
66

7-
<div data-widget-name="menu">Choose the genre</div>
7+
<div data-widget-name="menu">Escolha o gênero</div>
88

99
<script>
10-
// getting it
10+
// Obtendo o elemento
1111
let elem = document.querySelector('[data-widget-name]');
1212
13-
// reading the value
13+
// lendo o valor
1414
alert(elem.dataset.widgetName);
15-
// or
15+
// ou
1616
alert(elem.getAttribute('data-widget-name'));
1717
</script>
1818
</body>

2-ui/1-document/06-dom-attributes-and-properties/1-get-user-attribute/task.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ importance: 5
22

33
---
44

5-
# Get the attribute
5+
# Obtendo o atributo
66

7-
Write the code to select the element with `data-widget-name` attribute from the document and to read its value.
7+
Escreva o código para selecionar o elemento do documento com o atributo `data-widget-name` e leia seu valor.
88

99
```html run
1010
<!DOCTYPE html>
1111
<html>
1212
<body>
1313

14-
<div data-widget-name="menu">Choose the genre</div>
14+
<div data-widget-name="menu">Escolha o gênero</div>
1515

1616
<script>
17-
/* your code */
17+
/* seu código */
1818
</script>
1919
</body>
2020
</html>

2-ui/1-document/06-dom-attributes-and-properties/2-yellow-links/solution.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
First, we need to find all external references.
2+
Primeiro, precisamos encontrar todas as referências externas.
33

4-
There are two ways.
4+
Há duas maneiras.
55

6-
The first is to find all links using `document.querySelectorAll('a')` and then filter out what we need:
6+
A primeira é encontrar todos os links usando `document.querySelectorAll('a')` e então filtrar o que precisamos:
77

88
```js
99
let links = document.querySelectorAll('a');
@@ -12,23 +12,23 @@ for (let link of links) {
1212
*!*
1313
let href = link.getAttribute('href');
1414
*/!*
15-
if (!href) continue; // no attribute
15+
if (!href) continue; // sem atributo
1616

17-
if (!href.includes('://')) continue; // no protocol
17+
if (!href.includes('://')) continue; // sem protocolo
1818

1919
if (href.startsWith('http://internal.com')) continue; // internal
2020

2121
link.style.color = 'orange';
2222
}
2323
```
2424

25-
Please note: we use `link.getAttribute('href')`. Not `link.href`, because we need the value from HTML.
25+
Observe: usamos `link.getAttribute('href')`. Não `link.href`, porque precisamos do valor do HTML.
2626

27-
...Another, simpler way would be to add the checks to CSS selector:
27+
...Outra forma mais simples seria apenas adicionar as verificações ao seletor CSS
2828

2929
```js
30-
// look for all links that have :// in href
31-
// but href doesn't start with http://internal.com
30+
// procura por todos os links que tem :// em href
31+
// mas href não começa com http://internal.com
3232
let selector = 'a[href*="://"]:not([href^="http://internal.com"])';
3333
let links = document.querySelectorAll(selector);
3434

2-ui/1-document/06-dom-attributes-and-properties/2-yellow-links/solution.view/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<body>
44

5-
<a name="list">The list:</a>
5+
<a name="list">A lista:</a>
66
<ul>
77
<li><a href="http://google.com">http://google.com</a></li>
88
<li><a href="/tutorial">/tutorial.html</a></li>

2-ui/1-document/06-dom-attributes-and-properties/2-yellow-links/source.view/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<body>
44

5-
<a name="list">The list:</a>
5+
<a name="list">A lista:</a>
66
<ul>
77
<li><a href="http://google.com">http://google.com</a></li>
88
<li><a href="/tutorial">/tutorial.html</a></li>
@@ -13,7 +13,7 @@
1313
</ul>
1414

1515
<script>
16-
// ...your code...
16+
// ...seu código...
1717
</script>
1818

1919
</body>

2-ui/1-document/06-dom-attributes-and-properties/2-yellow-links/task.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ importance: 3
22

33
---
44

5-
# Make external links orange
5+
# Faça com que links externos fiquem laranja
66

7-
Make all external links orange by altering their `style` property.
7+
Faça com que todos os links externos fiquem laranjas alterando a propriedade `style`.
88

9-
A link is external if:
10-
- Its `href` has `://` in it
11-
- But doesn't start with `http://internal.com`.
9+
Um link é externo se:
10+
- Seu `href` contém `://`.
11+
- Mas não começa com `http://internal.com`.
1212

13-
Example:
13+
Por exemplo:
1414

1515
```html run
16-
<a name="list">the list</a>
16+
<a name="list">a lista</a>
1717
<ul>
1818
<li><a href="http://google.com">http://google.com</a></li>
1919
<li><a href="/tutorial">/tutorial.html</a></li>
@@ -24,12 +24,12 @@ Example:
2424
</ul>
2525

2626
<script>
27-
// setting style for a single link
27+
// Definindo o estilo para um único link
2828
let link = document.querySelector('a');
2929
link.style.color = 'orange';
3030
</script>
3131
```
3232

33-
The result should be:
33+
O resultado deverá ser:
3434

3535
[iframe border=1 height=180 src="solution"]

0 commit comments

Comments
 (0)