-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add text imports #11933
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
base: main
Are you sure you want to change the base?
Add text imports #11933
Conversation
Adds support for the `{ type: 'text' }` import attribute,
which enables importing text content as a JavaScript string.
|
Looks good. I do wonder whether there ought to be a required MIME type, especially given that the other types all have one. If Alternatively there could be a requirement not to have certain MIME types, e.g. to disallow importing JavaScript as text. I think I am personally inclined not to impose such requirements, but I could see the argument either way. |
|
Would this make available the same content that is already available via |
|
Good question. Looks like For clarity it might be good to rename the destination to Anyway, yes, this ends up letting you get the exact same content as |
|
Do we actually want a |
|
|
|
It's specific in that we can ask the server for JSON with Given that the destination is exposed these days through |
|
Oh, nice, I didn't realize that it got exposed there and wasn't just editorial. In that case I agree |
This is the HTML counterpart for the newly-introduced TC39 Import Text Stage 2 proposal; this has been previously discussed here in #9444, and is closely related (but not blocking on) PR #11657, which correspondingly adds byte imports.
The
type: 'text'import attribute is introduced here without any MIME type requirement, and without any validity or well-formedness checks on the returned string value. @sffc has raised some concerns about additional validation steps being desirable for text content, which would be appropriate for consideration in this spec, rather than the JS spec.The implementer support noted below is based on feedback from delegates at the 2025 November TC39 meeting.