dom content load load - amorfati0310/javascript-vm GitHub Wiki
dom content Download
๊ฐ๋ฐ์ ๋๊ตฌ ๋คํธ์ํฌ ํจ๋ testํ ๋๋ disable cache๋ก ์ ์ฒด๋ฅผ ๋ณด๋ ๊ฒ์ด ๋ ์ข๋ค
์๋ก๊ณ ์นจ ์๋์ DomContentLoad 338ms Load 708ms ๋ผ๋ ๋ฌธ๊ตฌ๋ฅผ ๋ณผ ์ ์๋ค. ๋์ ํ์ํ ContentLoad๊ฐ ๋์๋ค. Load๋ ์ด๋ฏธ์ง๋ผ๋์ง ์ธ๋ถ ์์๊น์ง ๋ค ๋ก๋๊ฐ ๋์์ ๋ ๋ ์๊ฐ
๋ณดํต dom์ด load๋ ํ์ ์์ ํ๊ฒ ํ์ผ์ ์์ํจ ๐
document.addEventListener("DOMContentLoaded", function(event) {
init();
});
์ฐธ๊ณ ํฌ๋ก์ค ๋ธ๋ผ์ฐ์ง
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", function () {
document.removeEventListener("DOMContentLoaded", arguments.callee, false);
domReady(); }, false);
}
// Internet Explorer
else if (document.attachEvent) {
document.attachEvent("onreadystatechange", function () {
if (document.readyState === "complete") {
document.detachEvent("onreadystatechange", arguments.callee);
domReady();
} }); }
//DOM์ด ๋ชจ๋ ๋ก๋ ๋์์ ๋ function domReady () { //์ฒ๋ฆฌํ ๋ด์ฉ }
load๊ฐ ๋ ํ์๋ ์ด๋ค ๊ฒ์ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข์๊น
img