The "initialization" steps for Web browsers

Ian Hickson ian at
Tue Jun 10 11:01:07 PDT 2014

(I first tried to send this last week, but it seems the es-discuss
mailman is filtering some of my mail as spam or something?)


I've been working with jorendorff to try to write a description of the
Loader part of the ES6 spec, to make sure I have a good grip of what the
spec says before I look at how I need to hook into it to define the Web's
dependency mechanism in the context of HTML Imports, etc.

As part of this, I'm trying to understand how I should hook the HTML spec
into the ES6 spec for the purposes of regular <script> execution.

Is my understanding correct that the HTML spec should invoke this
algorithm when the HTML spec creates the Window object?:

If so, what should the browser do in step 7? I don't fully understand how
this is supposed to work. Suppose a page is just:

   <script> alert(document.body.innerHTML); </script>
   <script> alert(document.body.innerHTML); </script>

If I read the #sec-initialization algorithm correctly, the scripts will
execute back-to-back with no change in the DOM, so they'll output the same
text. But the Web requires that these output different text, since the
second <script> element won't be in the DOM when the first executes:

Should I just say to invoke that algorithm but skip steps 6-8?

(Also, how could step 6's substeps ever get triggered?)

Ian Hickson               U+1047E                )\._.,--....,'``.    fL       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the es-discuss mailing list