-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Overview
Breaking the SSR part off from #35 since there were a couple thoughts going on there and thought it might be better to keep them separate
As "Web Components" itself is an umbrella label for a subset of web standards and APIs native to browsers, it is an exercise left up to developers who want to server-render web components to shim the DOM themselves on the server, typically in a JavaScript (e.g. NodeJS) runtime. It would be nice as a community if we could define what a common set of reasonable Web Components and Web Components adjacent APIs for the server-side would like.
This could just be a documented spec / reference, or even a package that can be distributed out on npm for libraries and frameworks and to leverage.
Specification
I think first would be establishing what we would consider a reasonable set of shims to be for a server environment.
At the most basic, that would seem to include:
window/documentcustomElements.[define|get]HTMLElementaddEventListener(no-op?)HTMLTemplateElementattachShadow.[get|set|has]Attribute<template>/DocumentFragment
Shared Polyfill
Much like the @webcomponentsjs family of polyfills, it would be nice for this CG to maintain / contribute this as a library that could be published to npm.
It would be nice if this is something that could be extended from so if libraries and frameworks want to add additional support on top of the baseline, they can offer that.
Prior Art
(please comment below and share others!)
(who knows, maybe we even "upstream" this into the WinterCG spec! 🤩 )