Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28867
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: JavaScript execution and threading |
| Date | 2015-11-01 15:17 +0000 |
| Message-ID | <011120151517425502%timstreater@greenbee.net> (permalink) |
| References | <MPG.30a0296f71698746989695@news.eternal-september.org> |
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. -- New Socialism consists essentially in being seen to have your heart in the right place whilst your head is in the clouds and your hand is in someone else's pocket.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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