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
精彩评论