don't confuse parse with compilation with evaluate or render.
parsing is straight top to bottom. and that was the question,so that is the answer.
rendering is incremental when each node of the html is ready to be rendered! (img iframes...)
javascript is 'compiled' after the <script> node is parsed, and then evaluated, this may be way before the dom is ready! some parts are not ready at load time!
in javascript this can be seen when you determine an image size before the image is loaded.
mainline code in the <script> doesn't have access to the entire dom, because it was not yet rendered.
I use jquery (http://jquery.com) where the ready state of the dom is separated from the parse/compile/evaluate time!
Well, that's probably more info than you needed, but the order of evaluation on an html page makes a big difference for serious sites!