Skip to content

Inline JSON and CSS module scripts #7415

Open
@domenic

Description

@domenic

Opening a dedicated issue since this is related to both #7367 and #7388 but needs its own discussion.

#7367 proposes a way that inline JSON and CSS module scripts might become useful. However the problem space might be somewhat complicated. In particular:

  • How do we express that a <script type="module"> is a JSON or CSS module script? We can't just do <script type="module">.css { prop: value; }</script> as we'll end up trying to parse that as JavaScript.

  • Relatedly, do we need import assertions for inline JSON/CSS module scripts? Probably not for the original security reasons since there's no remote server which could start serving JS where the page is expecting CSS...

  • How do these interact with other web platform features that restrict CSS, e.g. CSP? Maybe they don't, since they're isomorphic to <script type="module">export default new CSSStyleSheet()...;</script>?

  • Are inline CSS module scripts valuable? I think they're basically the same functionality as <style disabled>...</style>.

To be clear, I'm not proposing we do this right now. But I thought it'd be good to record the issues and have a place to discuss them, in case a strong use case arises.

/cc @whatwg/modules

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions