Skip to content

Commit f2195d2

Browse files
JuYeong0413Violet-Bora-Lee
authored andcommitted
[속성과 프로퍼티] 과제 번역
1 parent e0edfd5 commit f2195d2

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# Get the attribute
5+
# 속성 가져오기
66

7-
Write the code to select the element with `data-widget-name` attribute from the document and to read its value.
7+
문서에서 `data-widget-name`이라는 속성을 가진 요소를 찾고, 해당 요소의 값을 읽는 코드를 작성해 보세요.
88

99
```html run
1010
<!DOCTYPE html>

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
First, we need to find all external references.
2+
먼저 외부 참조를 모두 찾아야 합니다.
33

4-
There are two ways.
4+
두 가지 방법을 사용해 외부 참조를 찾을 수 있습니다.
55

6-
The first is to find all links using `document.querySelectorAll('a')` and then filter out what we need:
6+
첫 번째 방법은 `document.querySelectorAll('a')`를 사용해 모든 링크를 찾은 후 필요한 것만 걸러내는 것입니다.
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; // 속성이 존재하지 않음
1616

17-
if (!href.includes('://')) continue; // no protocol
17+
if (!href.includes('://')) continue; // 프로토콜이 존재하지 않음
1818

19-
if (href.startsWith('http://internal.com')) continue; // internal
19+
if (href.startsWith('http://internal.com')) continue; // 내부 링크
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+
참고: HTML의 값이 필요하기 때문에 `link.href`가 아니라 `link.getAttribute('href')`를 사용합니다.
2626

27-
...Another, simpler way would be to add the checks to CSS selector:
27+
더 간단한 방법은 CSS 선택자에 조건을 명시해 주는 것입니다.
2828

2929
```js
30-
// look for all links that have :// in href
31-
// but href doesn't start with http://internal.com
30+
// href에 :// 가 포함된 모든 링크를 찾습니다.
31+
// 그 중 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/task.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ importance: 3
22

33
---
44

5-
# Make external links orange
5+
# 외부 링크를 주황색으로 만들기
66

7-
Make all external links orange by altering their `style` property.
7+
`style` 프로퍼티를 변경해 모든 외부 링크를 주황색으로 만들어 보세요.
88

9-
A link is external if:
10-
- Its `href` has `://` in it
11-
- But doesn't start with `http://internal.com`.
9+
외부 링크가 되기 위한 조건은 아래와 같습니다.
10+
- `href``://`가 포함되어 있어야 합니다.
11+
- 하지만 `http://internal.com`으로 시작하지 않아야 합니다.
1212

13-
Example:
13+
예시:
1414

1515
```html run
1616
<a name="list">the list</a>
@@ -30,6 +30,6 @@ Example:
3030
</script>
3131
```
3232

33-
The result should be:
33+
결과:
3434

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

0 commit comments

Comments
 (0)