5 ms·
You could use WCs for that stuff, but WCs aren't best for those purposes. 1) YouTube/Twitter widget: Use an iframe, because WCs don't render at all with JS dis
by dfabulich 7y ago
You could use WCs for that stuff, but WCs aren't best for those purposes.
1) YouTube/Twitter widget: Use an iframe, because WCs don't render at all with JS disabled.
2) Interactive chart: You don't need WCs for this case; they make nothing easier and many things harder. Just use DOM APIs directly if your requirements lightweight, or use a popular framework if you need more support.
3) Standard library: That's the interop problem they're talking about up thread. That's literally the only thing WCs are good for, and even then, the fact that they don't render at all with JS disabled means that they're never going to be better/faster than rendering UI server side.
- csande17 7y agoI think web components fall back to regular elements if JavaScript doesn't run. So <twitter-tweet>Cats are the best!</twitter-tweet> and <button is="very-fancy-material-design-button">Click here!</button> would still show up for JS-disabled users, they just wouldn't have the extra JavaScript functionality.
- phpnode 7y agoIn practice this would be <twitter-tweet id="424242424242"></twitter-tweet> What you're saying is true only for the simplest of components.