Skip to content

Commit 8e7c484

Browse files
Merge pull request #1867 from Jeongbin1/sync-c26
[문서] 2-ui/4-forms-controls 충돌 해결 및 미번역분 번역
2 parents 76ff81a + 886e7fe commit 8e7c484

4 files changed

Lines changed: 31 additions & 148 deletions

File tree

2-ui/4-forms-controls/1-form-elements/article.md

Lines changed: 21 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,11 @@
88

99
폼은 특수한 컬렉션인 `document.forms`의 구성원입니다.
1010

11-
<<<<<<< HEAD
12-
`document.forms`는 이름과 순서가 있는 '기명 컬렉션(named collection)'입니다. 개발자는 이 이름이나 순서를 사용해 문서 내의 폼에 접근할 수 있습니다.
11+
`document.forms`는 이름과 순서가 있는 *'기명 컬렉션(named collection)'* 입니다. 개발자는 이 이름이나 순서를 사용해 문서 내의 폼에 접근할 수 있습니다.
1312

1413
```js no-beautify
15-
document.forms.my - 이름이 'my'인 폼
16-
document.forms[0] - 문서 내의 첫 번째 폼
17-
=======
18-
That's a so-called *"named collection"*: it's both named and ordered. We can use both the name or the number in the document to get the form.
19-
20-
```js no-beautify
21-
document.forms.my; // the form with name="my"
22-
document.forms[0]; // the first form in the document
23-
>>>>>>> upstream/master
14+
document.forms.my; // 이름이 'my'인 폼
15+
document.forms[0]; // 문서 내의 첫 번째 폼
2416
```
2517

2618
이름이나 순서를 사용해 원하는 폼을 가져온 다음에는 기명 컬렉션 `form.elements`를 사용해 폼의 요소를 얻을 수 있습니다.
@@ -44,15 +36,9 @@ document.forms[0]; // the first form in the document
4436
</script>
4537
```
4638

47-
<<<<<<< HEAD
48-
그런데 개발을 하다 보면 이름이 같은 요소 여러 개를 다뤄야 하는 경우가 생기기도 합니다. 라디오 버튼을 다룰 때 이런 상황이 자주 발생하죠.
39+
그런데 개발을 하다 보면 이름이 같은 요소 여러 개를 다뤄야 하는 경우가 생기기도 합니다. 라디오 버튼이나 체크박스를 다룰 때 이런 상황이 자주 발생하죠.
4940

50-
이때 `form.elements[name]`은 컬렉션이 된다는 사실을 이용할 수 있습니다. 예시를 살펴봅시다.
51-
=======
52-
There may be multiple elements with the same name. This is typical with radio buttons and checkboxes.
53-
54-
In that case, `form.elements[name]` is a *collection*. For instance:
55-
>>>>>>> upstream/master
41+
이때 `form.elements[name]`*컬렉션*이 된다는 사실을 이용할 수 있습니다. 예시를 살펴봅시다.
5642

5743
```html run height=40
5844
<form>
@@ -133,11 +119,7 @@ alert(ageElems[0]); // [object HTMLInputElement]
133119
</script>
134120
```
135121

136-
<<<<<<< HEAD
137122
그런데 폼 요소의 이름을 변경하는 일은 드물기 때문에 보통은 이런 특징이 문제가 되지 않습니다.
138-
=======
139-
That's usually not a problem, however, because we rarely change names of form elements.
140-
>>>>>>> upstream/master
141123

142124
````
143125
@@ -173,11 +155,7 @@ That's usually not a problem, however, because we rarely change names of form el
173155
174156
### input과 textarea
175157
176-
<<<<<<< HEAD
177-
input과 textarea 요소의 값은 `input.value` (string) 또는 `input.checked`(boolean)을 사용해 얻을 수 있습니다.
178-
=======
179-
We can access their value as `input.value` (string) or `input.checked` (boolean) for checkboxes and radio buttons.
180-
>>>>>>> upstream/master
158+
input과 textarea 요소의 값은 `input.value` (string)로 얻을 수 있고, 체크박스와 라디오 버튼의 경우 `input.checked`(boolean)를 사용해 선택 여부를 확인할 수 있습니다.
181159
182160
이렇게 말이죠.
183161
@@ -198,33 +176,17 @@ input.checked = true; // 체크박스나 라디오 버튼에서 쓸 수 있습
198176
199177
`<select>` 요소에는 세 가지 중요 프로퍼티가 있습니다.
200178
201-
<<<<<<< HEAD
202179
1. `select.options` -- `<option>` 하위 요소를 담고 있는 컬렉션
203-
2. `select.value` -- 현재 선택된 `<option>` 값
204-
3. `select.selectedIndex` -- 현재 선택된 `<option>`의 번호(인덱스)
205-
=======
206-
1. `select.options` -- the collection of `<option>` subelements,
207-
2. `select.value` -- the *value* of the currently selected `<option>`,
208-
3. `select.selectedIndex` -- the *number* of the currently selected `<option>`.
209-
>>>>>>> upstream/master
180+
2. `select.value` -- 현재 선택된 `<option>` *값*
181+
3. `select.selectedIndex` -- 현재 선택된 `<option>`의 *번호(인덱스)*
210182
211183
이 세 프로퍼티를 응용하면 아래와 같은 세 가지 방법으로 `<select>`의 값을 설정할 수 있습니다.
212184
213-
<<<<<<< HEAD
214-
1. 조건에 맞는 `<option>` 하위 요소를 찾아 `option.selected`속성을 `true`로 설정합니다.
185+
1. `select.options`등에서 조건에 맞는 `<option>` 요소를 찾아 `option.selected`속성을 `true`로 설정합니다.
215186
2. `select.value`를 원하는 값으로 설정합니다.
216187
3. `select.selectedIndex`를 원하는 option 번호로 설정합니다.
217188
218-
세 방법 중 첫 번째 방법이 가장 확실하지만 두 번째나 세 번째 방법이 대체로 더 편리합니다.
219-
220-
예시:
221-
=======
222-
1. Find the corresponding `<option>` element (e.g. among `select.options`) and set its `option.selected` to `true`.
223-
2. If we know a new value: set `select.value` to the new value.
224-
3. If we know the new option number: set `select.selectedIndex` to that number.
225-
226-
Here is an example of all three methods:
227-
>>>>>>> upstream/master
189+
세 가지 방법을 모두 사용한 예시를 살펴봅시다.
228190
229191
```html run
230192
<select id="select">
@@ -234,30 +196,17 @@ Here is an example of all three methods:
234196
</select>
235197
236198
<script>
237-
<<<<<<< HEAD
238199
// 세 가지 코드의 실행 결과는 모두 같습니다.
239200
select.options[2].selected = true;
240-
=======
241-
// all three lines do the same thing
242-
select.options[2].selected = true;
243-
>>>>>>> upstream/master
244201
select.selectedIndex = 2;
245202
select.value = 'banana';
246203
// please note: options start from zero, so index 2 means the 3rd option.
247204
</script>
248205
```
249206
250-
<<<<<<< HEAD
251-
대부분의 다른 폼 조작 요소와 달리 `<select>`는 `multiple` 속성이 있는 경우 option을 다중 선택할 수 있습니다. `multiple` 속성을 쓰는 경우는 아주 드물지만, 쓰게 되다면 첫 번째 방법을 사용해 `<option>` 하위 요소에 있는 `selected` 프로퍼티를 추가·제거해야 합니다.
252-
253-
선택된 여러 개의 option이 담긴 컬렉션은 다음 예시처럼 `select.options`를 사용해 얻을 수 있습니다.
254-
=======
255-
Unlike most other controls, `<select>` allows to select multiple options at once if it has `multiple` attribute. This attribute is rarely used, though.
207+
대부분의 다른 폼 조작 요소와 달리 `<select>`는 `multiple` 속성이 있는 경우 option을 다중 선택할 수 있습니다. `multiple` 속성을 쓰는 경우는 아주 드물지만, 쓰게 된다면 첫 번째 방법을 사용해 `<option>` 하위 요소에 있는 `selected` 프로퍼티를 추가·제거해야 합니다.
256208
257-
For multiple selected values, use the first way of setting values: add/remove the `selected` property from `<option>` subelements.
258-
259-
Here's an example of how to get selected values from a multi-select:
260-
>>>>>>> upstream/master
209+
선택된 여러 개의 option이 담긴 컬렉션은 다음 예시처럼 `select.options`를 사용해 얻을 수 있습니다.
261210
262211
```html run
263212
<select id="select" *!*multiple*/!*>
@@ -280,51 +229,33 @@ Here's an example of how to get selected values from a multi-select:
280229
281230
### Option 생성자
282231
283-
<<<<<<< HEAD
284-
Option 생성자는 잘 사용되지는 않지만 흥미로운 점이 있습니다.
285-
286-
[명세서](https://html.spec.whatwg.org/multipage/forms.html#the-option-element)를 보면 `<option>` 요소를 생성하는 간단하고 멋진 문법을 찾을 수 있죠.
287-
=======
288-
In the [specification](https://html.spec.whatwg.org/multipage/forms.html#the-option-element) there's a nice short syntax to create an `<option>` element:
289-
>>>>>>> upstream/master
232+
[명세서](https://html.spec.whatwg.org/multipage/forms.html#the-option-element)를 보면 `<option>` 요소를 생성하는 간단하고 멋진 문법을 찾을 수 있습니다.
290233
291234
```js
292235
option = new Option(text, value, defaultSelected, selected);
293236
```
294237
295-
<<<<<<< HEAD
238+
이 문법은 선택 사항입니다. `document.createElement('option')`를 사용해 요소를 만들고 속성을 직접 설정해도 되지만, 이 문법을 사용하면 더 짧게 쓸 수 있습니다.
239+
296240
매개변수:
297-
=======
298-
This syntax is optional. We can use `document.createElement('option')` and set attributes manually. Still, it may be shorter, so here are the parameters:
299-
>>>>>>> upstream/master
300241
301242
- `text` -- option 내부의 텍스트
302243
- `value` -- option의 값
303244
- `defaultSelected` -- `true`이면 HTML 속성 `selected`가 생성됨
304245
- `selected` -- `true`이면 해당 option이 선택됨
305246
306-
<<<<<<< HEAD
307-
`defaultSelected``selected`의 차이가 무엇인지 헷갈릴 수 있습니다. `defaultSelected``option.getAttribute('selected')`를 사용해 얻을 수 있는 HTML 속성을 설정해 줍니다. 반면 `selected` 는 option의 선택 여부를 결정합니다. 그렇기 때문에 당연히 `selected`가 더 중요한 매개변수이죠. Option 생성자를 사용할 때는 대개 두 매개변수 모두를 `true``false`로 설정합니다.
247+
`defaultSelected`와 `selected`의 차이가 무엇인지 헷갈릴 수 있습니다. `defaultSelected`는 `option.getAttribute('selected')`를 사용해 얻을 수 있는 HTML 속성을 설정해 줍니다. 반면 `selected` 는 option의 선택 여부를 결정합니다.
308248
309-
예시:
310-
=======
311-
The difference between `defaultSelected` and `selected` is that `defaultSelected` sets the HTML-attribute (that we can get using `option.getAttribute('selected')`), while `selected` sets whether the option is selected or not.
312-
313-
In practice, one should usually set _both_ values to `true` or `false`. (Or, simply omit them; both default to `false`.)
249+
Option 생성자를 사용할 때는 대개 두 매개변수 _모두_ `true`나 `false`로 설정합니다. 둘 다 생략할 수 있고, 이때 기본값은 둘 다 `false`입니다.
314250
315-
For instance, here's a new "unselected" option:
316-
>>>>>>> upstream/master
251+
예를 들어 '선택되지 않은' 새 option은 다음과 같이 만들 수 있습니다.
317252
318253
```js
319254
let option = new Option("Text", "value");
320255
// <option value="value">Text</option> 가 생성됩니다.
321256
```
322257
323-
<<<<<<< HEAD
324-
이번엔 같은 요소를 선택된 상태로 생성합니다.
325-
=======
326-
The same option, but selected:
327-
>>>>>>> upstream/master
258+
이번엔 같은 요소를 선택된 상태로 생성해 봅시다.
328259
329260
```js
330261
let option = new Option("Text", "value", true, true);
@@ -358,15 +289,9 @@ Option을 사용해 만든 요소에는 다음과 같은 프로퍼티가 있습
358289
`element.form`
359290
: 요소는 `form` 프로퍼티에서 자신이 속한 폼을 참조합니다.
360291
361-
<<<<<<< HEAD
362-
각 요소의 값은 `input.value`, `textarea.value`, `select.value` 등으로 접근할 수 있습니다. 체크박스와 라디오 버튼에서는 `input.checked`를 사용할 수 있습니다.
363-
364-
`<select>`에서는 인덱스 `select.selectedIndex`나 option 컬렉션 `select.options`을 통해 값을 구할 수도 있습니다.
365-
=======
366-
Value is available as `input.value`, `textarea.value`, `select.value`, etc. (For checkboxes and radio buttons, use `input.checked` to determine whether a value is selected.)
292+
각 요소의 값은 `input.value`, `textarea.value`, `select.value` 등으로 접근할 수 있습니다. 체크박스와 라디오 버튼에서는 값이 선택되었는지 확인하려면 `input.checked`를 사용합니다.
367293
368-
For `<select>`, one can also get the value by the index `select.selectedIndex` or through the options collection `select.options`.
369-
>>>>>>> upstream/master
294+
`<select>`에서는 인덱스 `select.selectedIndex`나 option 컬렉션 `select.options`를 통해 값을 구할 수도 있습니다.
370295
371296
지금까지는 폼 관련 기본을 다뤘습니다. 이 튜토리얼에서 앞으로 더 많은 예시를 만날 것입니다.
372297

2-ui/4-forms-controls/2-focus-blur/4-edit-td-click/task.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,10 @@ importance: 5
66

77
셀을 클릭하면 해당 셀을 수정할 수 있게 해주는 테이블을 만들어보세요.
88

9-
<<<<<<< HEAD
10-
- 셀 클릭 시 셀 안에 textarea가 나타나면서 셀에 들어 있는 콘텐츠(HTML)를 '수정'할 수 있어야 합니다. 이때 textarea 크기는 기존 cell 크기와 같아야 합니다.
9+
- 셀 클릭 시 셀 안에 textarea가 나타나면서 셀에 들어 있는 콘텐츠(HTML)를 '수정'할 수 있어야 합니다. 이때 textarea 크기는 기존 cell 크기와 같아야 하며, 전체 배치가 그대로 유지되어야 합니다.
1110
- 셀 수정 시 셀 아래쪽에 '완료'와 '취소' 버튼이 노출되도록 하고, 각 버튼을 누르면 수정이 종료, 취소될 수 있게 합니다.
1211
- 한 번에 하나의 셀만 수정할 수 있어야 합니다. `<td>`가 '수정 중'일 때는 다른 셀을 눌러도 클릭 이벤트가 무시되어야 합니다.
1312
- 테이블엔 더 많은 셀이 추가될 수 있으므로 이벤트 위임을 사용하세요.
14-
=======
15-
- On click -- the cell should become "editable" (textarea appears inside), we can change HTML. There should be no resize, all geometry should remain the same.
16-
- Buttons OK and CANCEL appear below the cell to finish/cancel the editing.
17-
- Only one cell may be editable at a moment. While a `<td>` is in "edit mode", clicks on other cells are ignored.
18-
- The table may have many cells. Use event delegation.
19-
>>>>>>> upstream/master
2013

2114
데모:
2215

2-ui/4-forms-controls/2-focus-blur/5-keyboard-mouse/task.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ importance: 4
88

99
[demo src="solution"]
1010

11-
<<<<<<< HEAD
1211
참고1: `#mouse` 요소 이외의 어느 곳에도 이벤트 핸들러를 달지 마세요.
1312

1413
참고2: HTML과 CSS를 수정하지 마세요. 작성할 자바스크립트는 어떤 요소에서도 동작할 수 있는 범용성이 있어야 합니다.
15-
=======
16-
P.S. Don't put event handlers anywhere except the `#mouse` element.
17-
18-
P.P.S. Don't modify HTML/CSS, the approach should be generic and work with any element.
19-
>>>>>>> upstream/master

0 commit comments

Comments
 (0)