Live data from Hacker News

HTML Web Components

blog.jim-nielsen.com

211–220 of 247 posts

Re: HTML Web Components

#211
A problem I faced recently with web components using shadow dom is styling nested components within custom element:

From we can give styles to

https://example.com/path/to/img.jpg" alt="..." />

but not anymore when its below

https://example.com/path/to/img.jpg" alt="..." />

Re: HTML Web Components

#212
post #207

Apparently not widely know, but… > Svelte components can also be compiled to custom elements (aka web components) using the customElement: true compiler option. https://svelte.dev/docs/custom-elements-api This would negate the "vendor lock-in" arguments and allow Svelte for component development but web component for consumption and use. Best of both worlds. All the DX advantages of Svelte over web components without…

I believe some people generally avoid Svelte for custom elements since Rich (and other maintainers) have consistently shown criticism towards Web Components in general.

Re: HTML Web Components

#213
As someone forced to use an in-house library of html web components at work,I will opine, run. Run at full speed away from the shadow DOM. It's cumbersome to work, poorly supported in testing tools, and web components themselves are a pain to deal with when your use case doesn't perfectly match the original build.

I'd like to like them, but, no.

Re: HTML Web Components

#214
post #189

Earlier quoted context omitted.

> Every alternative to the big frameworks (looking at you htmlx) feel like minor syntaxic sugar for jQuery Have you used htmx? Since it doesn't solve the same problem jquery did (UX for client side JS), the accusation is misplaced. htmx is (primarily) a way of avoiding writing JS by extending the server-side rendered html paradigm to partial pages instead of full page re-loads.

I think he knows that. The comparison with jQuery comes from the fact it is a DOM replacement logic too. Even if the syntax is way better, in the end, it’s still a way of working that scales badly, compared to components which embed their own logic. htmx shines to add dynamic behaviour on some pages, but is not appropriate to replace a medium-sized SPA in my opinion.

I personally think htmx augmenting a MPA approach is perfect for medium-sized apps.

Re: HTML Web Components

#215

Maybe it is just me but for me web-components were never able to deliver what they promised or a viable solution for a simple reason: i18n/translations. As a European freelance web dev, I've virtually never been in a project where we develop single-language UIs - its always at least the national language plus English. Those translations can't reside within a "component" itself for a simple reason: Translators push yo…

@lit/localize (https://lit.dev/docs/localization/overview/) give you the same DX of react-intl, but for (lit-powered) web components

Re: HTML Web Components

#216
post #143

Earlier quoted context omitted.

> But I believe this whole "anti-react" movement isn't talking about such usecases, but rather against defaulting frameworks and building using them 'from the ground up', where trully all the website actually need is the "sparkling of interactivity on top" We absolutely don't have shared language for these things and we aren't always talking about the same things. The thing is there are just vanishingly few places wh…

Would this example be considered "trivial"? https://www.youtube.com/watch?v=3GObi93tjZI But also, you can mix things togheter. You can just use react based app 'embeded' into mpa for when you need that heavy lifting, and the same keep the content part of your app simple. "But why would i do that, if i'd already use react for some parts, why not every where". Becuase then it leads to abominations like reddit or facebo…

The wall of HTML soup he shows for facet "component" (time 11.33) is something I don't want to ever see again in professional setting.

Stringly typed logic and CSS / JS somewhere miles away in directory structure making it very hard to reason about.

I very much prefer sticking to small, composable, encapsulated, actual components made in React or sth similar.

Re: HTML Web Components

#217
post #115

Earlier quoted context omitted.

>Every alternative to the big frameworks (looking at you htmlx) feel like minor syntaxic sugar for jQuery and friends True >which feels like a massive step backwards and completely the wrong choice for building a web app. Why? I mean, I'd agree if by 'web-app' you mean something like google-sheets. But I believe this whole "anti-react" movement isn't talking about such usecases, but rather against defaulting framewor…

> But I believe this whole "anti-react" movement isn't talking about such usecases, but rather against defaulting frameworks and building using them 'from the ground up', where trully all the website actually need is the "sparkling of interactivity on top" We absolutely don't have shared language for these things and we aren't always talking about the same things. The thing is there are just vanishingly few places wh…

Fully agree, thanks for elucidating.

IME there’s a crazy amount of strawmanning that goes on with these “anti-react” technologies/cults. Yes of course your html and css static site doesn’t need react. But most of us who are actual software devs/engineers aren’t working on static websites like that!

Re: HTML Web Components

#218
post #143

Earlier quoted context omitted.

> But I believe this whole "anti-react" movement isn't talking about such usecases, but rather against defaulting frameworks and building using them 'from the ground up', where trully all the website actually need is the "sparkling of interactivity on top" We absolutely don't have shared language for these things and we aren't always talking about the same things. The thing is there are just vanishingly few places wh…

Would this example be considered "trivial"? https://www.youtube.com/watch?v=3GObi93tjZI But also, you can mix things togheter. You can just use react based app 'embeded' into mpa for when you need that heavy lifting, and the same keep the content part of your app simple. "But why would i do that, if i'd already use react for some parts, why not every where". Becuase then it leads to abominations like reddit or facebo…

I don’t like Facebook but claiming it’s a “glorified text forum” is utterly absurd. Please argue in good faith here

Re: HTML Web Components

#219

Earlier quoted context omitted.

> But I believe this whole "anti-react" movement isn't talking about such usecases, but rather against defaulting frameworks and building using them 'from the ground up', where trully all the website actually need is the "sparkling of interactivity on top" We absolutely don't have shared language for these things and we aren't always talking about the same things. The thing is there are just vanishingly few places wh…

> The thing is there are just vanishingly few places where you only need a "sparkling of interactivity on top". I would say it's precisely the opposite. Say 97% of work done by web pages and web apps in practice boils down to "render some data available on the server as HTML, then show it to the user". For these cases, putting what amounts to an entire GUI framework written in Javascript on the frontend is massive, b…

What is this “entire GUI framework written in JavaScript”? React isn’t a GUI framework, even Angular despite being quite batteries included is not that.

I swear the people writing these comments aren’t working in web development?

Re: HTML Web Components

#220
post #218
post #143

Earlier quoted context omitted.

Would this example be considered "trivial"? https://www.youtube.com/watch?v=3GObi93tjZI But also, you can mix things togheter. You can just use react based app 'embeded' into mpa for when you need that heavy lifting, and the same keep the content part of your app simple. "But why would i do that, if i'd already use react for some parts, why not every where". Becuase then it leads to abominations like reddit or facebo…

I don’t like Facebook but claiming it’s a “glorified text forum” is utterly absurd. Please argue in good faith here

But it is though? I'm not talking about everything facebook provides, but main content page is just a list of posts with with discussion underneath them. Sure, you can embed some media into the it, but still. There is nothing inherently different about structure of facebook post compared to a post on a forum.

And yet, despite everything facebook is doing, the most (and only) reliable way to load new comments under the post is to force refresh entire site. Except it's not easy anymore, because facebook tries to be SPA.

So we gave up simple and reliable solutions in favour of over engineering that doesn't even work. And all that for no good reason, other then being trendy and having an SPA

Post reply on HN