Open
Description
What is the issue with the HTML Standard?
This topic is for discussion of #10673, which is a Stage 1 proposal.
The current explainer uses URL-like module syntax to define a module identifier. The TPAC breakout session had some discussion around initiating a network fetch for the given module name if one hasn't been defined declaratively.
Specifically, this would mean that specifying the following markup:
<my-element>
<template shadowrootmode="open" adoptedstylesheets="/foo.css">
<!-- ... -->
</template>
</my-element>
without an existing definition of foo.css
in the module graph would:
- Initiate a fetch for foo.css
- Validate the MIME type of "foo.css" returned
- Upon load complete of the fetch from step 1
- Add "foo.css" to the module graph
- Parse the content of foo.css as a CSS style sheet
- Apply the contents of "foo.css" from the prior step as
adoptedStyleSheets
in the provided<template>
element
This would essentially be a markup-equivalent of https://web.dev/articles/css-module-scripts
Is this something that is desired by developers? If so, there are a number of follow-up issues to clarify, but I want to determine fetching in general makes sense with this feature.