Live data from Hacker News

If Web Components are so great, why am I not using them?

daverupert.com

41–50 of 189 posts

Re: If Web Components are so great, why am I not using them?

#41
I'm not using them because WebKit (i.e. Apple), in a long-standing vendor pissing contest¹ they've tunnel-vision'd themselves into, still refuses²³ to implement the customized built-in elements⁴ part of the standard, without which the content model for HTML cannot be fully realized (e.g. custom elements inside a table), and to make matters worse, without offering a firm proposal or implementation of an equivalent alternative.

(and this is something a polyfill can only partially bridge)

[1] https://github.com/WICG/webcomponents/issues/509#issuecommen...

[2] https://bugs.webkit.org/show_bug.cgi?id=182671

[3] https://github.com/WebKit/standards-positions/issues/97

[4] https://html.spec.whatwg.org/multipage/custom-elements.html#...

Re: If Web Components are so great, why am I not using them?

#42
It's been a while, and overall I'd like them to succeed, but here are the first issues I remember.

The fact that scoped elements are not yet part of the standard is quite a turn off. Every web component is global and the first one that uses a name wins. Even if you are not competing with third party libraries you will need to have multiple versions of your same component very soon to handle breaking changes.

The string only passing is an headache when you'd like to pass object/functions to compare later on.

The fact that some CSS properties can bleed in the shadow Dom, while others don't.

To introduce them into an existing codebase you need support, and last time I checked the support from React was clunky

Re: If Web Components are so great, why am I not using them?

#43
post #31

Earlier quoted context omitted.

The latter doesn’t have any dependencies or a build step though right? That’s a big win that can be easily overlooked. But it depends what you’re optimising for…

I don't know many (any?) people who are greenfielding just-JavaScript, though. If you're using JavaScript in anger, you should probably be using TypeScript, and now you've got a build step regardless. Which is not a bad thing. Incremental builds have gotten much better and much easier to deal with.

> greenfielding just-JavaScript, though

There are still some frameworks that let you write fancy front-ends without a build-step and associated tooling. And there's people like me who prefer those since they meet our needs.

Re: If Web Components are so great, why am I not using them?

#44

I've been using web components now for years and I will do everything I can to never write frontends in anything else. I totally agree with point 2 though: the Polymer phase was very weird, but, as mentioned, https://lit.dev is great and, imo, the perfect abstraction.

Would love to peruse a couple example repos for learning if you can share some public links.

Re: If Web Components are so great, why am I not using them?

#46
post #42

It's been a while, and overall I'd like them to succeed, but here are the first issues I remember. The fact that scoped elements are not yet part of the standard is quite a turn off. Every web component is global and the first one that uses a name wins. Even if you are not competing with third party libraries you will need to have multiple versions of your same component very soon to handle breaking changes. The stri…

I've been able to piece-meal RiotJS components into an existing code base pretty easy.

Tools like React, etc al, requires almost doing everything that way.

RiotJS fits in for adding a bit to "old-school" web-apps (PHP, Ruby, Perl, ASP3).

Legacy backend, slightly more modern frontend.

Re: If Web Components are so great, why am I not using them?

#48

The main reason is that they're too low-level to use directly. They do a lot, but stop just short of being useful without something of a framework on top. I tried hard to use them directly, but found that it was untenable without sensible template interpolation, and without helpers for event binding. Here's my shot at the smallest possible "framework" atop Web Components that make them workable (and even enjoyable) a…

Template Instantiation is suppose to be the answer at least in part, but it’s been held up since 2017[0]

The bigger problem is that the web platform stakeholders (IE the committees that industry influence and the browser makers) simply didn’t listen at all to what regular developers have been saying about what they want from the web platform w/r/t better built in platform provided primitives. It’s seems to me like web components have largely not taken lessons of component based development as everyone has come to expect. It’s still a weird imperative API with no rendering or data binding primitives

[0]: https://github.com/WICG/webcomponents/blob/gh-pages/proposal...

Re: If Web Components are so great, why am I not using them?

#50

I'm not using them because WebKit (i.e. Apple), in a long-standing vendor pissing contest¹ they've tunnel-vision'd themselves into, still refuses²³ to implement the customized built-in elements⁴ part of the standard, without which the content model for HTML cannot be fully realized (e.g. custom elements inside a table), and to make matters worse, without offering a firm proposal or implementation of an equivalent alt…

An apparent polyfill, FWIW: https://github.com/WebReflection/custom-elements-builtin
Post reply on HN