Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28871

Re: JavaScript execution and threading

From Joao Rodrigues <groups_jr-1@yahoo.com.br>
Newsgroups comp.lang.javascript
Subject Re: JavaScript execution and threading
Date 2015-11-04 06:57 -0200
Organization Aioe.org NNTP Server
Message-ID <n1cha3$fm4$1@speranza.aioe.org> (permalink)
References <MPG.30a0296f71698746989695@news.eternal-september.org> <011120151517425502%timstreater@greenbee.net> <MPG.30a061b6529c750a989696@news.eternal-september.org>

Show all headers | View raw


On 11/01/2015 03:52 PM, Philip Herlihy wrote:
> In article <011120151517425502%timstreater@greenbee.net>,
> timstreater@greenbee.net says...
>>
>> In article <MPG.30a0296f71698746989695@news.eternal-september.org>,
>> Philip Herlihy <thiswillbounceback@you.com> wrote:
>>
>>> Not quite sure even what question to ask here!
>>>
>>> I'm learning JavaScript - I have four textbooks, including one which
>>> provides 3,000 lines of tested code, so I can stand on someone's
>>> shoulders (Plug-in Javascript).  I'm an experienced coder, but new-ish
>>> to JavaScript.  I'm using the (surprisingly good) debugger built-in to
>>> Chrome, and I've also tried the (also good) one in IE.
>>>
>>> Things don't happen quite when I expect them.  As I step over code which
>>> changes a CSS colour, or kicks off a routine to fade an image in or out,
>>> often nothing happens in the browser window.  When I trace execution I
>>> can see that messages get logged to the console as per directions, but
>>> the overall execution seems "loosely" connected to what I've written.
>>
>> It's going to depend on when the rendering takes place. I think one may
>> assume [1] that everything that you add, alter, move or whatever in
>> your javascript sequence won't happen until all your code has run. So
>> if some javascript is caused to be run because you click a button, in
>> effect the rendering only takes place after your code sequence has
>> completed.
>>
>> I'm also guessing that different browsers may do things differently or
>> in different orders. The only exception I found to the "your code must
>> complete first" rule is that browsers may do what is apparently called
>> speculative downloading. If you write some html into, say, an iframe,
>> or if you replace the iframe's DOM with another, the browser might
>> start parsing that and downloading any images or other items it needs
>> *before* your javascript completes. In particular, this defeats any
>> attempt one might be making to (for example) sanitise the iframe's DOM.
>>
>> [1] I'm making assumptions and guesses here based on observation only;
>> I'm presenting a hypothesis. I have no actual knowledge of how browsers
>> operate internally.
>
> That does make sense.  I'll look for any evidence of this!
>

I hope this article will help to understand how browsers work:
<http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/>

-- 
Joao Rodrigues

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

JavaScript execution and threading Philip Herlihy <thiswillbounceback@you.com> - 2015-11-01 13:52 +0000
  Re: JavaScript execution and threading Tim Streater <timstreater@greenbee.net> - 2015-11-01 15:17 +0000
    Re: JavaScript execution and threading Philip Herlihy <thiswillbounceback@you.com> - 2015-11-01 17:52 +0000
      Re: JavaScript execution and threading Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-11-04 06:57 -0200
        Re: JavaScript execution and threading Philip Herlihy <thiswillbounceback@you.com> - 2015-11-04 12:12 +0000
          Re: JavaScript execution and threading Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2015-11-04 13:19 +0100
            Re: JavaScript execution and threading Philip Herlihy <thiswillbounceback@you.com> - 2015-11-04 12:31 +0000

csiph-web