4 ms·
The important thing about web components is that we _can_ import the component's script and then have new useful HTML tags. You can drop this on a page and it
by spankalee 6y ago
The important thing about web components is that we _can_ import the component's script and then have new useful HTML tags.
You can drop this on a page and it _just works_:
<script type="module" src="https://unpkg.com/chessboard-element?module"></script>
<chess-board></chess-board>
And this is built with LitElement.
Live demo: https://jsbin.com/kicelemara/2/edit?html,output https://jsbin.com/kicelemara/2/edit?html,output
Having dependencies doesn't change the external interface to an element, or prevent it from being drop-in. Dependencies are very often good, because they are well tested implementations of a common need, rather than ad hoc implementations that may be brittle or duplicative.
- isochronous 6y agoYes, thank you. I don't know why "they have dependencies" is a valid criticism. Literally any complex thing where the developer didn't write 100% of the code has dependencies. Most of the dependencies for the web components we use at work are... other web components, which is EXACTLY THE POINT of web components: reusability, portability, encapsulation. I'll agree with a few of her points, but as far as this point goes, I have to wonder what components she's trying to use here. And if she wants to see the full markup of the shop demo, all she has to do is use "inspect element" on it rather than "view source."