Skip to content

Conversation

@KurtCattiSchmidt
Copy link

@KurtCattiSchmidt KurtCattiSchmidt commented Dec 2, 2025

Updates the definition of modulepreload to support as="style" and as="json" for preloading style and JSON module scripts respectively.

Fixes #10233

(See WHATWG Working Mode: Changes for more details.)


/acknowledgements.html ( diff )
/indices.html ( diff )
/links.html ( diff )
/semantics.html ( diff )

@KurtCattiSchmidt KurtCattiSchmidt changed the title Expanding <link type="modulepreload"> to allow "style" and "json" in as attribute Allow "style" and "json" in as attribute in modulepreload Dec 2, 2025
@KurtCattiSchmidt KurtCattiSchmidt changed the title Allow "style" and "json" in as attribute in modulepreload Allow "style" and "json" in as attribute for modulepreload Dec 2, 2025
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also disallow "json" for <link rel=preload>?

@KurtCattiSchmidt
Copy link
Author

Should we also disallow "json" for <link rel=preload>?

You're right, "json" doesn't really make sense in preload if it's supported for modulepreload. I think this should be handled separately though, because WebKit recently added support for <link rel=preload as=json>, and we can have both for some window of time.

Filed #11995 to track and discuss separately.

@annevk
Copy link
Member

annevk commented Dec 8, 2025

I'd rather tackle them together as I have a feeling #11995 will not be addressed anytime soon otherwise. And it would be good to have that infrastructure in place as we add more types, such as text and bytes.

@KurtCattiSchmidt
Copy link
Author

I assumed there would be some window of overlap between the new and deprecated version, which is why I filed a separate bug. But if we can do them in one shot that's great. This feature is a little different in that it's not directly observable, so it does seem safe to just deprecate.

I'll update this PR to remove <link type="preload" as="json"> today.

@rniwa - you recently added support for <link type="preload" as="json"> in WebKit so your input here is appreciated.

@KurtCattiSchmidt
Copy link
Author

KurtCattiSchmidt commented Dec 8, 2025

Latest push handles removing "json" for "preload". I also added the implementation bugs. I'll work on tests next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Support json/style as modulepreload destinations

2 participants