Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline JSON and CSS module scripts #7415

Open
domenic opened this issue Dec 13, 2021 · 0 comments
Open

Inline JSON and CSS module scripts #7415

domenic opened this issue Dec 13, 2021 · 0 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: script

Comments

@domenic
Copy link
Member

domenic commented Dec 13, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: script
Development

No branches or pull requests

2 participants