일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- a11y
- css:position
- keyboardEvent
- node.js
- nodeValue
- Dom
- Review
- for loop
- innerText
- keyup
- node
- addEventListener
- UI
- Event
- innerHTML
- yet
- Empty
- dotenv
- TypingEffect
- es6
- Temporal dead zone
- textContent
- ES5
- beforeinput
- modal
- js
- HTML
- CSS
- javascript
- react
- Today
- Total
the murmurous sea
DOMContentLoaded vs. load 본문
The DOMContentLoaded event fires when the document is loaded and the DOM tree is fully constructed.
The load event fires when all subframes, images, stylesheets, scripts, etc have been downloaded.
The lifecycle of an HTML page has three important events
DOMContentLoaded
: the browser fully loaded HTML, and the DOM tree is built, but external resources like pictures <img> and stylesheets may be not yet loaded.
load
: not only HTML is loaded, but also all the external resources: images, styles etc.
beforeunload/unload
: the user is leaving the page.
Each event may be useful:
DOMContentLoaded event
: DOM is ready, so the handler can lookup DOM nodes, initialize the interface.
load event
:external resources are loaded, so styles are applied, image sizes are known etc.
beforeunload event
: the user is leaving: we can check if the user saved the changes and ask them whether they really want to leave.
unload
: the user almost left, but we still can initiate some operations, such as sending out statistics.
'#dev > 개념정리' 카테고리의 다른 글
Nodejs: require vs import (0) | 2020.09.18 |
---|---|
DOM Events: mouseover/out & mouseenter/leave (0) | 2020.07.28 |
Reasons for setTimeout()/setInterval() delays longer than specified (0) | 2020.07.01 |
setTimeout vs. setInterval (0) | 2020.06.30 |
json.parse() vs. response.json (0) | 2020.06.25 |