by dmitriid · 9y ago · 0 comments
No. Polymer is here. As Rob Dodson said, "Polymer is the jQuery of WebComponents".
No one in their right mind would even think about writing and using WebComponents in vanilla JS.
Hence we're coming back to the problem with WebComponents: they are a solution in search of a problem.
Why not? I have written a complete widget toolkit [1] this way. With vanilla APIs the code is a bit more verbose and repetitive, but in turn you get more options for speed optimization and fine-tuning.
As for optimization, vanilla won't be faster than a framework unless you write one from scratch. That means having a scheduler in place that orders dom read/writes, pooled events listening from a single source (the main document), a prioritizer that can cull, something that diffs state in order to render the minimal set of components, etc. Many don't realize the effort that goes into these libs to render as efficient as possible. Even if some stuff is baked into the browser, the field is moving so fast that we get higher benefits from community driven optimizations. And that is an understatement if you look at things like React Fiber.
Exactly. Just the code for syncing attributes and properties is enough to never ever use vanilla JS for WCs
I'd love to see that problem statement written anywhere in any of the webcomponent-related specs or sites.
If it were true, they would not have such cumbersome APIs, for example.
On the contrary, WebComponents, as they turn out to be, realise next to none of their original goals: https://fronteers.nl/congres/2011/sessions/web-components-an...
> but react seeks to provide more structure and functionality to the foundation of web components.
React has nothing to do with web components. Until less than a year ago React team was set against WebComponents in any shape or form: https://docs.google.com/document/d/1QZxArgMwidgCrAbuSikcB2iB...
What React was, and is, is a library with a specific goal that solved a specific problem, and it's basically this: "Build encapsulated components that manage their own state, then compose them to make complex UIs."
No one really knows what WebComponents are, and what problems they solve. I know what Polymer is and what it attempts to solve though.
That is ridiculous. They've come from some impetus, derived by some individuals, and they obviously had a goal in mind. They are in a spec, they're being implemented into browsers, they're emulated or polyfilled by various JS libraries, and they're being used by individuals around the web.
> I know what Polymer is and what it attempts to solve though.
The WebComponents spec is admittedly lacking a full feature set to truly enable "Encapsulated Components" but with really not very much work ( https://bitbucket.org/polylab/polyblocks ) you can get pretty close.
I guess I'm simply not understanding what all the fuss is about. I think those busy building with React and friends might see no point to it, because why not just build it in React right? But not everything needs to be a highly orchestrated complex UI, and in those circumstances I still want to be able to re-use my frontend code.
Yeah, yeah, yeah. Snake oil is also used by many people who say they know what they are doing.
And then you get presentations like this: https://www.youtube.com/watch?v=sK1ODp0nDbM where you learn that:
- people who implement the spec in the browser don't even have reference components
- people who try to sell the vision of WebComponents have to use pseudocode in their presentations because the APIs are horrendous
- the very same people casually drop things like "if we could only agree on how webcomponents should behave"
etc. etc. etc.
> I guess I'm simply not understanding what all the fuss is about. I think those busy building with React and friends might see no point to it, because why not just build it in React right?
Kinda. As someone else put it in the comment here: WebComponents are solving a problem no one has had for at least five years now. They are a solution in search of the problem. Worse still, they are entirely highjacked by Polymer.
uh, this applies to Web Components too. In what way do you think they're different?
Right now the narrative is "build reusable components that you can use anywhere regardless of library". We've been using jQuery components in our React projects for years, so the fuss is largely overrated.
And since the vast majority of components are extremely highly Polymer-specific, good luck figuring out how to work with their components, it's no better than figuring out how to hook up a jQuery component.
[1] https://fronteers.nl/congres/2011/sessions/web-components-an...
How about x-tag, a competing WP framework from Mozilla/Microsoft? I don't see any any mention of that.
If you go to webcomponents.org, you'll see that the overwhelming majority of components there are Polymer components.
It's like visiting a store called "phone" that sells iPhone exclusively. Google has definitely got own its down agenda with the so-called standards in this regard.
Unsurprisingly, a searching "x-tag" on webcomponents.org returns pathetically two components.
Not really a fair analogy as anyone can submit elements to webcomponents.org: https://www.webcomponents.org/publish
There's only Polymer.
It's gotten so bad that even the main proponents of WebComponents (working for Google, of course) cannot build proper WebComponents (and no one can): https://www.youtube.com/watch?v=sK1ODp0nDbM
The main problem: when the framework makes the developer decide whether to pass attributes or properties to Custom Elements, it's mostly ok. The framework should also allow binding any events (which cna be named as onEvent, or on-event or...)
Frameworks that are trying to be clever and hide the complexities of DOM behind proper APIs, and that implement their own event systems suffer greatly because DOM APIs and WebComponent APIs are a pile of steaming crap.
Also it is not helpful to call standards 'a pile of steaming crap' without backing that up with something substantive, examples/alternatives etc.