Allen Wirfs-Brock (2013-07-11T05:59:36.000Z)
domenic at domenicdenicola.com (2013-07-13T01:11:26.621Z)
On Jul 10, 2013, at 7:33 PM, Sam Tobin-Hochstadt wrote: > There are certainly races here, just the way that: > > ```html > <script async> > x > </script> > ``` > > races with such dynamic DOM insertions. > yes, but sometime like: ```html <script async> function getNode1() { return node1 / } function getNode2() { return node2 } </script> <div id='node1' /> <div id='node2' /> ``` never produces an error (note no calls, but in practice I assume it would be structured such that any calls to either of the functions would only occurs after the async script load was known to have completed). But if you try to modularize the code like: ```html <script async> module "mod" { export function getNode1() { return node1 } export function getNode2() { return node2 } } </script> <div id='node1' /> <div id='node2' /> ``` then it may randomly work or fail with an error depending upon who wins the race. What seems like it should be a safe refactoring instead produces non-deterministic intermittent errors.