Hi.

I'm just a beginner of javascript.

I'm just wondering how browser Engine works..

in this article i just consider about two main part of browser Engene.

the first one is html parser, and the other part is javascript
interpreter.

as i know html parser parses html  line by line.

I use inline javascript between HTML object like this line

so when tag is opend such as <div> ,

it is looking for the tag closed like </div>

and then the dom object is created on the screen.

what if i use <script> in the middle of HTML page??

ex)
<div>
<script>func1()</script>
</div>

I've found that

it looks like  HTML parser stop working while func1 is excuting..

however it's working actually it's wating for the  pair .

i think it is because <script> is also a kind of dom object.

so parse is wating for </script> ...

but but but but but..

before excution of func1 is fully finished,

the script block is not closed.

usullay, this kinda problem is not that big issue.

in case func1 takes lots of time, it can be a big problem.

It looks like it's loading very slowly..

what should i do???

I just did this.

settimeout(func1,1);

yeah I think it's kina nice way to optimize the page..

if I use 'settimeout', javascript interpreter just allocate the func1
to the browser memory .

in addtion, the <script>block is closed quickly and html parse can
keep working.

here's the question.

when html parser is making dom tree. the func1 in the browser memroy
will be excuted.

then,,,,,,do they work at the same time ?? or javascript interpreter
intercept the priority?????


Reply via email to