What triggers JavaScript code execution?
<p>In case you don't know what I'm talking about, please read <a href="http://ejohn.org/blog/how-javascript-timers-work/" rel="nofollow">John Resig - How JavaScript Timers Work</a> and <a href="http://stackoverflow.com/questions/2734025/is-javascript-guaranteed-to-be-single-threaded/2734311#2734311">Is javascript guaranteed to be single-threaded?</a></p>

<p>There are several triggers that enqueue tasks in the JS engines' execution FiFo. This is not part of any standard, so I'm trying to find an exhausive list of those triggers. (I guess it all boils down to internal event handlers, like <em>script load events</em> or <em>timer events</em>, but I'd rather ignore the engine's internals and look at things from the user's point of view.)</p>

<p>So far I have identified</p>

<ul>
<li><code>&lt;script&gt;</code> elements in the initial document (including the ones added by <code>document.write</code>)*</li>
<li><code>&lt;script&gt;</code> elements inserted by JS at runtime*</li>
<li>Event handlers<br>
-- these include a wide variety of cases, such as user interaction, Error events, Web Worker messages or Ajax callbacks ...</li>
<li><code>window.setTimeout</code></li>
<li><code>window.setInterval</code></li>
</ul>

<p>*) only in Browser/DOM environments</p>

<p>Any more? Any differences between JS engines?</p>
