Skip to content

Commit

Permalink
[오타수정] Part 2 5.1 DOMContentLoaded, load, beforeunload, unload 이벤트#1143
Browse files Browse the repository at this point in the history
  • Loading branch information
KangyeolLee authored and Violet-Bora-Lee committed Aug 19, 2021
1 parent f902ef5 commit 22ea3b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 2-ui/5-loading/01-onload-ondomcontentloaded/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ document.addEventListener("DOMContentLoaded", ready);

### DOMContentLoaded와 scripts

브라우저는 HTML 문서를 처리하는 도중에 `<script>` 태그를 만나면, DOM 트리 구성을 멈추고 `<script>`를 실행합니다. 스크립트실행이 끝난 후에야 나머지 HTML 문서를 처리하죠. `<script>`에 있는 스크립트가 DOM 조작 관련 로직을 담고 있을 수 있기 때문에 이런 방지책이 만들어 졌습니다. 따라서 `DOMContentLoaded` 이벤트 역시 `<script>` 안에있는 스크립트가 처리고 난 후에 발생합니다.
브라우저는 HTML 문서를 처리하는 도중에 `<script>` 태그를 만나면, DOM 트리 구성을 멈추고 `<script>`를 실행합니다. 스크립트실행이 끝난 후에야 나머지 HTML 문서를 처리하죠. `<script>`에 있는 스크립트가 DOM 조작 관련 로직을 담고 있을 수 있기 때문에 이런 방지책이 만들어 졌습니다. 따라서 `DOMContentLoaded` 이벤트 역시 `<script>` 안에 있는 스크립트가 처리되고 난 후에 발생합니다.

예시를 통해 이를 살펴봅시다.

Expand Down

0 comments on commit 22ea3b7

Please sign in to comment.