A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

[Proposal] Unified access to external and embedded resources

suns
2023-01-19

SVG images, script, and html content can be embedded into HTML, pre-loaded via LINK tag and included into DOM from external URI by specific tags.

The same mechanism is not available for generic kind of resource. There is no legitimate way to embedd say font or JSON data declaratively into page and reuse by matching layer even if the layer allows to use embedded resources via # URI. For example the font from CSS.

The image which is embedded into HTML and available over its ID is still unavailable withing CSS( sample link TBD) and as IMG tag.

Proposed

  • allow to embed the arbitrary content into HTML. This content is passive till used by usual means. Like in font url in css or image url.
  • associate with content type via 'content-type` attribute
  • treat url #id to embedded resource in same fashion as remote resource of given content type.
  • the content can be binary so has to be accompanied by encoding like Base64

Unblocked patterns:

  • build with embedded into page dependencies without wrapping them into inline script. Native embedding instead would not need the dispatching phase.
  • SVG DOM reuse by multiple IMG tags and CSS
  • true templates which are reused without cloning.
  • data island for Declarative Web Application and Declarative Custom Element

The tag to be used for embedding the content most likely have to be created. At the moment OBJECT, EMBED are close by meaning but presenting the inline content which is active and visible.

What the tag name would be a good match to semantic meaning?

simevidas
2023-01-23

This may be related to Web Bundles

suns
2023-01-24

@simevidas, It is deeper than bundling alone is you pay attention to Unblocked patterns section ^^