Skip to content

Commit a89fa20

Browse files
committed
#471 [주요 노드 프로퍼티] 과제3, 해답 번역
1 parent 352a3e4 commit a89fa20

File tree

1 file changed

+5
-5
lines changed
  • 2-ui/1-document/05-basic-dom-node-properties/3-tag-in-comment

1 file changed

+5
-5
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The answer: **`BODY`**.
1+
**`BODY`**가 출력됩니다.
22

33
```html run
44
<script>
@@ -10,8 +10,8 @@ The answer: **`BODY`**.
1010
</script>
1111
```
1212

13-
What's going on step by step:
13+
차근차근 설명해보겠습니다.
1414

15-
1. The content of `<body>` is replaced with the comment. The comment is `<!--BODY-->`, because `body.tagName == "BODY"`. As we remember, `tagName` is always uppercase in HTML.
16-
2. The comment is now the only child node, so we get it in `body.firstChild`.
17-
3. The `data` property of the comment is its contents (inside `<!--...-->`): `"BODY"`.
15+
1. `<body>`의 콘텐츠가 `<!--BODY-->`로 대체됩니다. `body.tagName``"BODY"`이기 때문입니다. `tagName`은 항상 대문자라는 점을 잊지 마세요.
16+
2. `<body>`의 콘텐츠가 교체되면서 주석이 유일한 자식 노드가 됩니다. 따라서 `body.firstChild`을 사용해 주석을 얻을 수 있게 됩니다.
17+
3. 주석 노드의 `data` 프로퍼티엔 주석 내용(`<!--...-->` 안쪽의 내용)이 저장됩니다. 따라서 `data` 프로퍼티의 값은 `"BODY"`입니다.

0 commit comments

Comments
 (0)