4 ms·
> I think that people that disregard Polymer fail to understand that Web Components are already here. No. Polymer is here. As Rob Dodson said, "Polymer is the
by dmitriid 9y ago
> I think that people that disregard Polymer fail to understand that Web Components are already here.
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.
- chenster 9y ago> As Rob Dodson said, "Polymer is the jQuery of WebComponents". How about x-tag, a competing WP framework from Mozilla/Microsoft? I don't see any any mention of that.
- dmitriid 9y agoBecause for all intents and purposes it's absolutely irrelevant. If you go to webcomponents.org, you'll see that the overwhelming majority of components there are Polymer components.
- chenster 9y agoWell, I think mainly it's because Google is behind webcomponents.org. It has ZERO mentioning on x-tag and other competing frameworks. Ironically, it is called "webcomponents.org". 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.
- allover 9y ago> It's like visiting a store called "phone" that sells iPhone exclusively Not really a fair analogy as anyone can submit elements to webcomponents.org: https://www.webcomponents.org/publish https://www.webcomponents.org/publish
- chenster 9y agoSure, but they could also add x-tag to their resource list.
- dmitriid 9y agoWhile this is true, it's also true that x-tags and whatever else that's not Polymer is entirely irrelevant in the context of WebComponents. 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 https://www.youtube.com/watch?v=sK1ODp0nDbM
- kinlan 9y ago> main proponents of WebComponents cannot build proper WebComponents (and no one can): I've a vested interest as I run the team that Rob is on, I feel like there is a lot being misconstrued here in this thread, x-tags is be on the list of supported resources on webcomponents.org. If there are only two elements on the list it's not because it's "polymer only" and run by the Chrome team. I've launched a couple of elements using plain JS and there are others on there too, it's just that many of the elements created use Polymer, and that is probably a good indicator of how popular the tooling is in the component ecosystem. Rob didn't say no one can build proper web components, he was saying that to build great web components there is a lot of work that you have to do especially to make them accessible and good actors in the life-cycle of a page and that many of the spec authors hadn't seen them being built as a canonical reference set. Of course people can build proper web components, but it is on us to explain it clearly now that the browser support is mostly there.
- dmitriid 9y ago> it's just that many of the elements created use Polymer, and that is probably a good indicator of how popular the tooling is in the component ecosystem. That's exactly what I'm saying. There are no WebComponents. There is no x-tags or whatever. There is only Polymer. For many reasons. Chief among them: WebComponents suck. Polymer at least gives nice-ish APIs on top of that. Rob did say something like "Polymer is the jQuery of WebComponents". And it's true. One could argue that you can write your stuff in pure DOM APIs. Yet hardly enyone ever did that, because there was jQuery. All the handlebars and mustaches and other things of this world were largely irrelevant because of jQuery. Now, jQuery solved a very pressing problem: it gave an easy, simple, extensible API that made working with the DOM a joy. It would be very nice if jQuery's approach was adopted by w3c, but that is really too much to ask for. In 11 years since jQuery's original release w3c managed — barely! — to standardize on querySelector/querySelectorAll (already a much more cumbersome combination of APIs than jQuery's $). Enter WebComponents. 6 years in development. Quite a few years of saying that they are the future. Let's do a reality check, shall we? The APIs are horrible. None of the original promises are fulfilled. As Polymer 3 approaches someone suddenly starts asking "erm, guys, what are the best ways of creating WebComponents without Polymer". - It turns out even people who implement the spec in the browser don't have reference components. - It turns out the API is so bad, you have to use pseudocode in your presentation to sell people the idea[1]. - It turns out WebComponents are so effing great and can really be used to reimplement stuff in the browser, ... that you can't even implement a checkbox without reimplementing the checkbox label [2] - It turns out people don't even know how WCs should work. Quote from [1]: "If we can generally agree on how Custom Elements should behave..." - It turns out that actually implementing WCs in anything but Polymer is a royal pain in basically everywhere because w3c's goal was never to create a sane API for anything. etc. etc. etc. Therefore, forget selling people the idea of WebComponents. For all intents and purposes they do not exist. Only Polymer exists. Masochists can go and check out the underlying DOM APIs, of course. [1] https://www.youtube.com/watch?v=sK1ODp0nDbM https://www.youtube.com/watch?v=sK1ODp0nDbM [2] https://github.com/GoogleChrome/howto-components/issues/112 https://github.com/GoogleChrome/howto-components/issues/112
- alwillis 9y agox-tag is mentioned on the WebComponents site--and it works with the same underlying technologies as Polymer: shadow dom, HTML imports, custom elements and templates: https://www.webcomponents.org/libraries https://www.webcomponents.org/libraries
- pjmlp 9y agoAngular and React also have plans to eventually move into Web Components.
- peterhunt 9y agoThis isn't true https://facebook.github.io/react/docs/web-components.html https://facebook.github.io/react/docs/web-components.html
- dmitriid 9y agoIt's partly true, see https://custom-elements-everywhere.com https://custom-elements-everywhere.com and linked issues. 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.
- allover 9y agoThe site you linked to is about frameworks 'playing well with' custom elements. It says nothing to the assertion about React moving to web components. Also it is not helpful to call standards 'a pile of steaming crap' without backing that up with something substantive, examples/alternatives etc.
- ourcat 9y agoAren't Angular directives more or less Web Components?
- chenster 9y agoVue.js probably has a better chance for building true distributable componetns. https://vuejs.org/v2/guide/components.html https://vuejs.org/v2/guide/components.html
- jarek-foksa 9y ago> No one in their right mind would even think about writing and using WebComponents in vanilla JS. 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. [1] https://github.com/jarek-foksa/xel https://github.com/jarek-foksa/xel
- mlsarecmg 9y agoYou get a small set of APIs that allow you to encapsulate, so what, encapsulation never was the problem. Now how do you bind, how does the UI react to store changes, how do you bring state managers into this, etc. We'd be in 2010 fighting the naked dom all over again. 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.
- dmitriid 9y ago> With vanilla APIs the code is a bit more verbose and repetitive Exactly. Just the code for syncing attributes and properties is enough to never ever use vanilla JS for WCs
- ehnto 9y agoThey are not a solution in search of a problem. They have a very clear problem statement, it's hard to orchestrate reusable front-end code. React's problem statement is roughly the same, but react seeks to provide more structure and functionality to the foundation of web components. The WebComponent spec is just trying to formalise that foundation.
- dmitriid 9y ago> They have a very clear problem statement, it's hard to orchestrate reusable front-end code. 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-and-model-driven-views-alex-russell 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/1QZxArgMwidgCrAbuSikcB2iBxkffH6w0YB0C1qCsuH0/edit 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.
- ehnto 9y ago> No one really knows what WebComponents are 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 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.
- rhodesjason 9y agoFWIW a google search on that quote shows it was from Monica Dinculescu, if you don't mind updating that attribution. Thanks! https://meowni.ca/posts/web-components-with-otters/ https://meowni.ca/posts/web-components-with-otters/