by qwtel · 3y ago · 0 comments
It offers nothing in way of ensuring that custom elements behave like builtin HTML elements. Half the elements I've come across will break or perform no-ops when you update an attribute or set a propety after it was attached to the DOM. Nevermind detaching and reattaching to the DOM, which will break virtually all of them (including my own sad contributions to this space).
The exception to this are those built using a 3rd party library like lit-element or stenciljs, which fill in the obvious omissions of these specs. Perhaps in another 10 years, a mangled version of half of one of them can be standardized? In the meantime, each component shipping its own frontend library or inlining the same core functions over and over again does nothing in the way of interoperability. You can bundle every popular JS framework and mix their components today. The reason you don't do it then or now is bloat, not the lack of a minimally viable shared component interface.
Besides, if you're going to use a 3rd party library and associated bundler/compiler, you might as well pick a good one such as React, Vue, Svelete, Solid or even jQuery UI. Using any of these, you can design and build an entire app faster than the bikeshedding commissars from goog and aapl can agree on whether "open" or "closed" should be the default for attaching a shadow DOM (at the risk of ruining the joke: there was no agreement; the developer has to provide a value in each instance...)
You have to invent all your own wiring and passing of events, state-management et cetera if you go that route.
edit: no one is saying a purpose-built framework needs to do everything that a mass-market framework ecosystem does. it's disingenuous to think there aren't circumstances it would make sense, not all of us make forms for a living.
I mean, you can do all that. And either spend your time writing tons of boilerplate code, or reinventing half of those frameworks and libraries anyway.
And still having to deal with issues like having to remember that they don't participate in forms (more JS to each component), that a11y can suddenly be broken (when your label references an element inside shadow dom), that wcs are not extensible to SVGs (which is important if your field is data visualisation) etc.
At which point you will go "why bother".
Because very few of the people developing web standards are web developers. And of those who are very few have done anything of note in the past 20 years or more.
They do love working on standards though.
html[stylus-iframe$="twitter.com"] h1 { display:none }
and I guess they could provide a similar sort of hack to select the Shadow DOM of an element to apply CSS e.g. .comment:shadow .title { font-size: 1.1rem; }
Seems pretty likely to be be a performance hog to do that though.This seems like the norm for tech now days. A lot of meeting and work and nothing major or significant really gets done. Seems like the the whole industry is about making it easier and simpler for new developers to get develop.
Regarding React, ES should just stick and simplify E4X that would just really make all these front end lib not necessary.
Unfortunately, it is the same churn that has vastly improved the ergonomics for many UI frameworks while we're stuck with the terrible workflows for authoring web components.
Is there a continuous churn?
React is 10 years this year. Vue is 9 years. Angular which feels positively ancient is 7 years (if we only count Angular 2.x).
Yes, there are newcomers like Svelte and Solid, but it's hardly a churn. Besides, they explore valuable corners that are left untouched and unexplored by other frameworks. Things like granular reactivity and removing components as a unit of UI in its entirety.
Meanwhile the "non-churn" in web components has already resulted in two deprecated standards (custom elements v0, html imports), and is rapidly churning out dozens of new standards requiring more and more javascript to paper over their egregious design (form participation, constructible stylesheets, declarative shadow dom...)
The good news is that the tooling around the Web components is evolving even when the standard itself may moving at glacial pace.
> The good news is that the tooling around the Web components is evolving
You mean web components are growing their own frameworks at the same pace :) With new APIs and breaking changes
In 12 years web components had:
- original lib, polymer. Breaking changes 1.0-> 2.0, then completely deprecated
- lit is 4 years old, already had breaking changes in each version update 1.0->2.0->3.0 (and "potential breaking changes" even in patch releases), and adds new APIs with every release
- stencil is 5 years, has already had breaking changes in 1.0->2.0, but is probably the most stable of them all
etc.
Looks on par with the rest of the industry :)
The sad thing is that web components as a standard don't allow is for actual iteration of ideas. While Solid, S, Marko et al are exploring granular reactivity, web components are stuck in 2010. And all the tools around them are doing what the rest of the tools have been doing for the DOM since time immemorial: invent new, better ways that are only hampered by the underlying platform.
And to have web components support built-in would mean to have them in the browser anyway, not in a third-party library.
What WebComponents support in SPAs bring to the table is a migration path to native support.