You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is, should the HTML script-execution infrastructure wait for the evaluation of the a.mjs script graph to run to completion and yield to the event loop, then start evaluating the b.mjs script graph? Or should it delay evaluating the b.mjs script graph until the a.mjs script graph's promise has settled?
Note that, per the TC39 semantics chosen, if instead the HTML file was
then the answer would be "wait for start". Should HTML depart from that?
My instinct is no; we should align <script>'s design with import's design and avoid earlier script graphs being able to indefinitely delay the evaluation of later ones. (Consider if a.mjs instead had await new Promise(() => {}).) The same reasoning given in the top-level await proposal seems to apply here; if b.mjs wants to wait on a.mjs, then b.mjs should take on an actual dependency (i.e., it should import './a.mjs'.) But, it is worth discussing, since we need to write the spec text and make a choice.
Since the issues are so similar between <script> and import, I encourage people to read the top-level await FAQ, which touches on import. Ideally we'd constrain this thread to discussing whether or not <script> should behave the same as import, and delegate the decision of how import behaves to that repository.
/cc @whatwg/modules
The text was updated successfully, but these errors were encountered:
I agree with @domenic's reasoning above, and have written this up as #4352 (though the FlushJobs text is likely to be removed given discussion in #4400).
Consider this example, in the context of the upcoming TC39 top-level await proposal:
Should the output be:
That is, should the HTML script-execution infrastructure wait for the evaluation of the a.mjs script graph to run to completion and yield to the event loop, then start evaluating the b.mjs script graph? Or should it delay evaluating the b.mjs script graph until the a.mjs script graph's promise has settled?
Note that, per the TC39 semantics chosen, if instead the HTML file was
then the answer would be "wait for start". Should HTML depart from that?
My instinct is no; we should align
<script>
's design withimport
's design and avoid earlier script graphs being able to indefinitely delay the evaluation of later ones. (Consider ifa.mjs
instead hadawait new Promise(() => {})
.) The same reasoning given in the top-level await proposal seems to apply here; if b.mjs wants to wait on a.mjs, then b.mjs should take on an actual dependency (i.e., it shouldimport './a.mjs'
.) But, it is worth discussing, since we need to write the spec text and make a choice.Since the issues are so similar between
<script>
andimport
, I encourage people to read the top-level await FAQ, which touches onimport
. Ideally we'd constrain this thread to discussing whether or not<script>
should behave the same asimport
, and delegate the decision of howimport
behaves to that repository./cc @whatwg/modules
The text was updated successfully, but these errors were encountered: