File tree Expand file tree Collapse file tree 6 files changed +15
-15
lines changed
2-ui/1-document/05-basic-dom-node-properties
2-lastchild-nodetype-inline
4-where-document-in-hierarchy Expand file tree Collapse file tree 6 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 1- There's a catch here .
1+ 함정이 있는 문제였습니다 .
22
3- At the time of ` <script> ` execution the last DOM node is exactly ` <script> ` , because the browser did not process the rest of the page yet .
3+ ` <script> ` 가 실행되는 시점엔 브라우저가 ` <script> ` 아래에 있는 문서를 처리하지 못했기 때문에 가장 마지막 DOM 노드는 ` <script> ` 자기 자신입니다 .
44
5- So the result is ` 1 ` (element node) .
5+ 따라서 얼럿창엔 ` 1 ` (요소 노드)이 출력됩니다 .
66
77``` html run height=60
88<html >
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ importance: 5
22
33---
44
5- # What's in the nodeType?
5+ # 노드 타입 맞추기
66
7- What does the script show?
7+ 스크립트를 실행 결과를 예측해보세요.
88
99``` html
1010<html >
Original file line number Diff line number Diff line change 1414
15151 . ` <body> ` 의 콘텐츠가 ` <!--BODY--> ` 로 대체됩니다. ` body.tagName ` 은 ` "BODY" ` 이기 때문입니다. ` tagName ` 은 항상 대문자라는 점을 잊지 마세요.
16162 . ` <body> ` 의 콘텐츠가 교체되면서 주석이 유일한 자식 노드가 됩니다. 따라서 ` body.firstChild ` 을 사용해 주석을 얻을 수 있게 됩니다.
17- 3 . 주석 노드의 ` data ` 프로퍼티엔 주석 내용(` <!--...--> ` 안쪽의 내용)이 저장됩니다. 따라서 ` data ` 프로퍼티의 값은 ` "BODY" ` 입니다.
17+ 3 . 주석 노드의 ` data ` 프로퍼티엔 주석 내용(` <!--...--> ` 안쪽의 내용)이 저장됩니다. 따라서 ` data ` 프로퍼티의 값은 ` "BODY" ` 입니다.
Original file line number Diff line number Diff line change @@ -2,16 +2,16 @@ importance: 3
22
33---
44
5- # 주석 안의 태그
5+ # 주석 안의 태그
66
7- 스크립트를 실행 결과를 예측해보세요.
7+ 스크립트를 실행 결과를 예측해보세요.
88
99``` html
1010<script >
1111 let body = document .body ;
1212
1313 body .innerHTML = " <!--" + body .tagName + " -->" ;
1414
15- alert ( body .firstChild .data ); // 얼럿 창엔 어떤 내용이 출력될까요?
15+ alert ( body .firstChild .data ); // 얼럿 창엔 어떤 내용이 출력될까요?
1616 </script >
17- ```
17+ ```
Original file line number Diff line number Diff line change @@ -37,4 +37,4 @@ alert(HTMLDocument.prototype.__proto__.__proto__.constructor.name); // Node
3737
3838위와 같은 코드를 사용해 계층 구조를 파악할 수 있습니다.
3939
40- 이 외에도 개발자 도구에서 ` console.dir(document) ` 를 사용해 객체를 검사하고, ` __proto__ ` 에 저장된 정보를 통해 이름을 알아낼 수도 있습니다. 브라우저 콘솔 내부에서 자동으로 ` constructor ` 의 이름을 추출하기 때문입니다.
40+ 이 외에도 개발자 도구에서 ` console.dir(document) ` 를 사용해 객체를 검사하고, ` __proto__ ` 에 저장된 정보를 통해 이름을 알아낼 수도 있습니다. 브라우저 콘솔 내부에서 자동으로 ` constructor ` 의 이름을 추출하기 때문입니다.
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ importance: 4
22
33---
44
5- # Where's the "document" in the hierarchy?
5+ # DOM 계층 구조와 'document'
66
7- Which class does the ` document ` belong to ?
7+ ` document ` 는 어떤 클래스에 속할까요 ?
88
9- What's its place in the DOM hierarchy ?
9+ DOM 계층 구조에서 ` document ` 이 속한 클래스는 어디에 위치해 있을까요 ?
1010
11- Does it inherit from ` Node ` or ` Element ` , or maybe ` HTMLElement ` ?
11+ 이 클래스는 ` Node ` , ` Element ` , ` HTMLElement ` 중 어떤 클래스를 상속받을까요 ?
You can’t perform that action at this time.
0 commit comments