> The promise of Web Components was that we’d get this convenience, but for a much wider range of HTML elements, developed much faster, as nobody needs to wait for the full spec + implementation process. We’d just include a script, and boom, we have more elements at our disposal! > > Or, that was the idea. Somewhere along the way, the space got flooded by JS frameworks aficionados, who revel in complex APIs, overengineered build processes and dependency graphs that look like the roots of a banyan tree. I think the issue is deeper than Verou's complaints, although those are valid. Web Components don’t actually to solve the problem they purport to solve. The pitch is “get **semantic elements** from **across the web**!” But those are **wrong problems** to try to solve. - - - - First of all, if search engines and screen readers don’t know about ``, it’s **not semantic** in any meaningful sense. There is already a very good way to provide semantic information to search engines: use [JSON-LD](https://en.wikipedia.org/wiki/JSON-LD) to provide [schema.org](https://schema.org) metadata. For accessibility, you need to either use the correct HTML5 element or use [ARIA attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/An_overview_of_accessible_web_applications_and_widgets), and this process is going to be the same whether you're using Web Components or something else. So next, **“from across the web”** is a performance killer. No matter how good networks and browsers get in the foreseeable future, you're not going to be able to build a content page from multiple domains in under a second just due to the latencies involved in connecting, and that's the performance goal content sites should be meeting. You need to at minimum host the scripts on your site. Once you're doing that, the temptation to just go ahead and bundle them is pretty strong. Yes, HTTP2 makes the price of having several small modules much lower, but it's hard to argue against minifying, concatenating, and tree shaking to pick up any remaining performance benefits. Now you've landed into the mess that it is modern JS bundling, for better or worse. Remember that best case here is that you end up at the fourth phase of [the dialectic of dependencies](https://twitter.com/carlmjohnson/status/982747054614220800): being overrun by low quality user written components. - - - - Okay, so what about the JavaScript for Web Components themselves. They have this system in which you subclass `HTMLElement` and register the class as custom element with `customElements.define()`. What does this buy you over and above just using `document.querySelectorAll("[data-my-element]")`? Not a lot. It gets you a system of lifecycle hooks. Cool, I guess, but it doesn't actually have any tools to manage your _data_ lifecycle, so it's not actually very useful. If you store your data in the DOM, it just becomes a bunch of strings on elements, and this stinks because most of you data is boolean (Is the widget open or closed? Am I waiting on a fetch to finish?) and has to be mutilated to fit into string (`el.attr === "true"` makes Alan Turing's ghost cry). And forget about compound types like arrays and maps. The only practical solution there is to serialize the data to JSON and store that on the element, which is crazy. So, you can use the Web Component custom element lifecycle to manage _element_ creation and deletion, but you need to have some other system for rationalizing the data lifecycle if your component is more complex than a `
` box. Web Components are also associated with `