On 7/8/09 17:59, Mark S. Miller wrote:
On Wed, Jul 8, 2009 at 5:48 PM,<[email protected]>  wrote:
sometimes an event handler can fire
while we're in middle of executing some other js

Hi Felix, could you expand on this some? Thanks.

this is modification of the example from the bug report:

<body>
<input type="text" id="a" value="init" onfocus="gotFocus()">
<script>
function gotFocus() { cajita.log(1); }
function f() {
    cajita.log(2);
    document.getElementById('a').focus();
    cajita.log(3);
    return 'ok';
}
f();
</script>
</body>

cajole that in firefox,
note that the log sequence is 2, 1, 3.
calling el.focus() apparently
calls el's onfocus handler before el.focus() returns.

I think this is not an async execution hazard,
it's just that a browser native function can decide
to call some arbitrary js function in the same runtime,
and event handlers are a special case of this.

Reply via email to