-
In a previous blog post about using #HTML fragments as a native "HTML-over-the-wire" solution, I proposed an
<embed />
tag as a possible #JavaScript-less approach to #SSR'd #WebComponents. I just realized I can easily prototype that proposal, so I did! blog.dwac.dev/posts/html-fragments/#ecosystem -
Want to inline an HTML fragment in your web page? Just drop an: <em-bed src="/path/to/some/fragment"></em-bed> Works pretty smoothly if I do say so myself. github.com/dgp1130/html-fragments-demo/blob/blog-post/client/embedded.html#L11
-
Implementation is just some 15 lines of code (plus the
parseDomFragment()
explained in the blog post). It just fetches the given URL, parses it as a fragment, and appends that fragment to the DOM. Would love to see this as a real web standard! github.com/dgp1130/html-fragments-demo/blob/blog-post/client/em-bed.ts