Alex Rivera | Logout

Is Javascript parsed/interpreted on load? (IE)

Asked 2009-12-11T17:19:58.043
9

I Know, for instance, that when Chrome downloads a Javascript file, it is interpreted and JITed.

My question is, when IE6,7,8, first download a Javascript file, is the entire thing parsed and interpreted?

My understanding was that only top level function signatures and anything executed in the global scope was parsed on load. And then function bodies and the rest were parsed on execution.

If they are fully parsed on load, what do you think the time savings would be on deferring the function bodies to be downloaded and parsed later?

Edit
Report

1 Answer

1

What do you mean by "downloads"? When it's included with tag, or when it's downloaded through XMLHttpRequest?

If you mean the inclusion by script, then IE interpret all js files at once. Otherwise you will be not able to call functions in that file or see syntax error message.

If you mean download by XMLHttpRequest, then you have to evaluate the content of the file yourself.

answered 2009-12-11T17:29:39.853

Your Answer