开发者

Order of loading DOM elements

Very simple question.

If I have this:

<link id="lowtech" rel="stylesheet" type="text/css" href="css/lowtech.css" />
&l开发者_如何学Ct;script type="text/javascript" src="js/engine.js"></script>

Inside the engine.js I have

document.getElementById("lowtech");

Will that always work? Does the browser load DOM elements in a linear fashion every time? Is there some specification about this process?


Will that always work?

Yes

Does the browser load DOM elements in a linear fashion every time?

The exception is when JS adds DOM elements. Since events can fire at different times, the instructions to add those elements can be run at different times.


if your document.getElement is after window.load event

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜