Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Where does the data come from, if not JS? How then do HTML Web Components start rendering, without data?


The data would come as part of the server response in most cases.

A variation could be the rendering of a partial UI whilst you then fetch data client-side. Even in this case the web component has the advantage as no JS is needed to render the initial UI.


As long as you're not shoving everything into the shadow dom, then you've got a fallback HTML element that can render before JS is read (and even if the JS is completely broken)...

<special-image>

  <img src="/example.png" />
</special-image>

This image will render before the JS is executed, so you've got no blockers and a perfectly fine fallback, then with the web component you enhance your image with whatever JS you want.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: