Live data from Hacker News

Plain Vanilla Web

plainvanillaweb.com

691–700 of 715 posts

Re: Plain Vanilla Web

#691
Truly valuable content! This got 1.4k points so far (and counting) for a reason. I have read the full four chapters in one shot, until I hit Go build something vanilla!. I'm definitely bookmarking it.

Also, at the beginning of the first chapter, I read:

> In theory it's possible to extend other classes.. but in practice this doesn't work yet in Safari.

And was like, Ugh! It's always Safari that ruins the party!

Re: Plain Vanilla Web

#692
post #66

I'm not against frameworks, but in many cases, they're unnecessary. I've always questioned why we should add 100KB of JavaScript to a page before writing a single line of real code. My team and I built https://restofworld.org without any frameworks. The feedback, from surveys, outreach, and unsolicited emails, has been overwhelmingly positive, especially around usability and reading experience. We might adopt a frame…

> My team and I built https://restofworld.org without any frameworks.

Puter (https://news.ycombinator.com/item?id=39597030) was also built purely using vanillaJS (or, JQuery to be more precise)

Re: Plain Vanilla Web

#693

Earlier quoted context omitted.

> I’m happy to do whatever makes the most sense in any given situation What makes the most sense in this situation: you walk to the nearest pizza place, you buy your pizza, done. To an able-bodied person it shouldn't take more than 5 minutes. Bonus points: you know the way back to your home. > because problem-solving is work You know who made someone else's problem a problem=solving problem? You. The delivery guy wil…

This is a completely unhinged response to the idea of getting pizza delivered...

> unhinged

while wanting to monitor what the delivery guy does while doing his job and pretending to "help" him because you truly believe that having tipped a couple dollars makes him your butler, that's completely normal...

alright...

There’s a reason why everyone hates the USA right now — one major reason is that, unlike in much of the world, you truly believe that workers don’t have rights.

Re: Plain Vanilla Web

#694
post #66

I'm not against frameworks, but in many cases, they're unnecessary. I've always questioned why we should add 100KB of JavaScript to a page before writing a single line of real code. My team and I built https://restofworld.org without any frameworks. The feedback, from surveys, outreach, and unsolicited emails, has been overwhelmingly positive, especially around usability and reading experience. We might adopt a frame…

The site is beautiful... and fast too.

Re: Plain Vanilla Web

#695
post #677
post #340

Earlier quoted context omitted.

I sell urns online and my website just has an email link. No shopping cart. A brick-and-mortor urn shop would never have a shopping cart, so why would a virtual one? I've purchased specialized woodworking tools online that simply involved filling out a form. I later received the parts with an invoice to send payment. You can simply not pay if you choose not to. There are so many way to do commerce both on and offline…

There's so many different people, and it's hard to know if that's made you lose customers. I would immediately discard any website that makes me send an email to order.

Me too. I don't want to be signed up for some email spam, and I don't want to initiate a conversation about buying something if I don't already have enough information about it to want to buy it.

Re: Plain Vanilla Web

#696

Once you're building custom components in JS files, aren't you basically writing your own microframework? Sure you don't need bundlers and compilers (such as TS to JS), but at some point you might need async updates on `fetch()` of components that also share state with other components. At this point you're into framework territory, whether using your own or someone else's. Producing a framework with those features t…

That's why there are an increasing number of "microframeworks" for Web Components such as Lit and FAST. (My own Butterfloat I think works very nicely in Web Components, too, though some would quibble that it isn't a "microframework" because its one and only dependency is RxJS, which isn't as bloated as people remember it being, but has that reputation.)

> (without updating the DOM each turn, hence shadow DOM).

Uh, Shadow DOM doesn't help with DOM performance and can make some things worse. If your Web Component has terrible DOM performance in the Shadow DOM that can still noticeably degrade DOM performance of the entire DOM.

I'm of the growing opinion that the Shadow DOM is over-complicated for what it tries to do and most Web Components don't actually need the Shadow DOM and would be better without it and would have a better idea of their own performance (issues) without it.

Hot take: The Shadow DOM is built for advertisers that want beefier iframes, not for building good performance.

Re: Plain Vanilla Web

#697
post #212

Earlier quoted context omitted.

Web Components don't solve the problems I do have and add new problems I don't want. Many of the 25 mentions of Shadow DOM in the Components Page and 14 mentions of it in the Styling page are about solving problems you now only have because the site recommended you use Shadow DOM, and the problem Shadow DOM itself is _trying_ to solve is one I don't have in components written specifically for my app, which will only…

Hard agree, from practical experience also. One thing will push you towards shadow dom (slots, for example) then ten things will push you back towards light dom. I don't exactly understand what the spec is aiming to solve with the way things currently are. But I do appreciate no build process.

Given the way most templates about Web Components are going it feels like a dirty secret that you don't need to use Shadow DOM at all when building Web Components and that it actually feels nice to build Web Components without it.

Re: Plain Vanilla Web

#698

I don't find WebComponents a good replacement for what in other web frameworks are called components. For one thing they don't support complex values like Objects and Arrays as attributes. The amount of boilerplate you have to write is way too high, and you still don't have reactivity. I do vanilla-ish JS using signals[1]. Not everything the W3C releases should be canon, XHTML is a testament to that. [1] https://wrnr…

A lot of the "boilerplate" of WebComponents disappears if you entirely ignore the Shadow DOM, and you can just do that.

They can support objects and arrays as attributes in the same way as the old Progressive Enhancement era (jQuery/Knockout-era) web: via data- attributes and the dataset property. Similar to that era you probably still want to support JSON serialization/deserialization to those attributes for SSG/SSR support.

Re: Plain Vanilla Web

#699
post #559

Earlier quoted context omitted.

Web components only solve the interoperable, encapsulated component problem. Rendering libraries like Lit handle declarative templates, and there are many state management solutions, the same ones you can use with React, etc.

Encapsulated - yes. Interoperable - can you expand on this?

Interoperable: You can build a Web Component once and it should work "out of the box" in the latest Angular, React, Vue, Svelte, etc. (React was among the last holdouts on Web Component support because of Virtual DOM silliness.) Interoperable Web Components get us away from the era of needing to build npm libraries like ng-mycomponent, react-mycomponent, vue-mycomponent, for all the various combinations of drastically different component systems and ways of writing components, even when your component's core was as Vanilla as you could make it and you shared as much code as you could between implementations there were still so many small subtle things to do differently.

Re: Plain Vanilla Web

#700
post #24

Very cool overview and a great article—it’s fascinating to see how far web components have come. Data passing, interactivity, and state management still seem pretty tedious in vanilla, though!

Data passing seems inherently broken in web components, because all HTML attrs must have string keys and values. Such a model just can't be built on top of.

The "old ways" are relevant again here. Just like in the old Progressive Enhancement era (the jQuery/Knockout era) to pass objects/arrays as attributes you use the special data- attributes and the `dataset` property. As the old ways suggest you probably still want to account for strings and serialize/deserialize via JSON for the most compatibility with things like static rendering, but many a jQuery script "upgraded" such things in-place.
Post reply on HN