[WIP] Introduce HTML Modules by dandclark · Pull Request #4505 · whatwg/html (original) (raw)

With the current design, dynamically added scripts won't execute (as if they were added to a dynamic document).

For non-dynamically-added scripts: after the HTML Module document is parsed, we basically take a snapshot of it at that time and the <script> elements at that point become the HTML module's child modules in the module graph. Fiddling dynamically with the HTML Module doc's tree after that point won't affect the structure of the module graph, and won't affect which scripts are executed or the order of execution.

I split the non-normative part of this line into a separate note and modified it to try to clarify what I meant here.

I'm open to creating an issue on the whatwg/html repo if you think this is contentious or needs to be open to wider discussion. Our design philosophy so far has generally been to treat the HTML module document as an inert dynamic document except for the special bits needed to enable HTML modules to work as a non-leaf node in the module graph.

Thanks for the feedback!