HTML web components

Web components have been around for quite a while, but it feels like they’re having a bit of a moment right now.

It turns out that the best selling point for web components was “wait and see.” For everyone who didn’t see the benefit of web components over being locked into a specific framework, time is proving to be a great teacher.

It’s not just that web components are portable. They’re also web standards, which means they’ll be around as long as web browsers. No framework can make that claim. As Jake Lazaroff puts it, web components will outlive your JavaScript framework.

At this point React is legacy technology, like Angular. Lots of people are still using it, but nobody can quite remember why. The decision-makers in organisations who chose to build everything with React have long since left. People starting new projects who still decide to build on React are doing it largely out of habit.

Others are making more sensible judgements and, having been bitten by lock-in in the past, are now giving web components a go.

If you’re one of those people making the move from React to web components, there’ll certainly be a bit of a learning curve, but that would be true of any technology change.

I have a suggestion for you if you find yourself in this position. Try not to bring React’s mindset with you.

I’m talking about the way React components are composed. There’s often lots of props doing heavy lifting. The actual component element itself might be empty.

If you want to apply that model to web components, you can. Lots of people do. It’s not unusual to see web components in the wild that look like this:

<my-component></my-component>

The custom element is just a shell. All the actual power is elsewhere. It’s in the JavaScript that does all kinds of clever things with the shadow DOM, templates, and slots.

There is another way. Ask, as Robin does, “what would HTML do?”

Think about composibility with existing materials. Do you really need to invent an entirely new component from scratch? Or can you use HTML up until it reaches its limit and then enhance the markup?

Robin writes:

I don’t think we should see web components like the ones you might find in a huge monolithic React app: your Button or Table or Input components. Instead, I’ve started to come around and see Web Components as filling in the blanks of what we can do with hypertext: they’re really just small, reusable chunks of code that extends the language of HTML.

Dave talks about how web components can be HTML with superpowers. I think that’s a good attitude to have. Instead of all-singing, all-dancing web components, it feels a lot more elegant to use web components to augment your existing markup with just enough extra behaviour.

Where does the shadow DOM come into all of this? It doesn’t. And that’s okay. I’m not saying it should be avoided completely, but it should be a last resort. See how far you can get with the composibility of regular HTML first.

Eric described his recent epiphany with web components. He created a super-slider custom element that wraps around an existing label and input type="range":

You just take some normal HTML markup, wrap it with a custom element, and then write some JS to add capabilities which you can then style with regular CSS!  Everything’s of the Light Side of the Web.  No need to pierce the Vale of Shadows or whatever.

When you wrap some existing markup in a custom element and then apply some new behaviour with JavaScript, technically you’re not doing anything you couldn’t have done before with some DOM traversal and event handling. But it’s less fragile to do it with a web component. It’s portable. It obeys the single responsibility principle. It only does one thing but it does it well.

Jim created an icon-list custom element that wraps around a regular ul populated with li elements. But he feels almost bashful about even calling it a web component:

Maybe I shouldn’t be using the term “web component” for what I’ve done here. I’m not using shadow DOM. I’m not using the templates or slots. I’m really only using custom elements to attach functionality to a specific kind of component.

I think what Eric and Jim are doing is exemplary. See also Zach’s web components.

At the end of his post, Eric says he’d like a nice catchy term for these kinds of web components. In Dave’s catalogue of web components, they’re called “element extensions.” I like that. It’s pretty catchy.

Or we could call them “HTML web components.” If your custom element is empty, it’s not an HTML web component. But if you’re using a custom element to extend existing markup, that’s an HTML web component.

React encouraged a mindset of replacement: “forgot what browsers can do; do everything in a React component instead, even if you’re reinventing the wheel.”

HTML web components encourage a mindset of augmentation instead.

Have you published a response to this? :

Responses

rem

@adactio I said this earlier this year, but feeling it moreso: I really feel like web components are (finally) starting to land in both our consciousness but also our fingertips (allowing us to actually use them day to day).

# Posted by rem on Thursday, November 9th, 2023 at 5:54pm

Eric A. Meyer

@adactio I think you hit on something there at the end: “Web augmentations” also feels like a pretty catchy term.

Stuart Langridge

@adactio good way to phrase things, I think. “Enhancement components”, maybe; some sort of name is a good idea. But the vibe of “wrap the proper markup in a component rather than making up your own markup” is one I hadn’t properly articulated inside my own head; good call!

Jono Ferguson

@adactio

“Lots of people are still using it, but nobody can quite remember why.”

Ahh humanity.

Aa someone who only plays with the front end when there are no adults nearby to tell me not to, web,components have had the right “vibe”. But I’ve not had a reason to properly play with them and have people cry: ” oh dear god no! Why would you?”

Luke Dary

@adactio in conversation, I’ve always just differentiated based on the specs. “Custom elements” versus Shadow DOM-enabled “web components”. Using a musical analogy, they’re both playing notes, but their composition generates different sounds, and that is okay.

# Posted by Luke Dary on Thursday, November 9th, 2023 at 6:33pm

Chris Hayes

@zachleat @davatron5000 the one thing that scares about web components is spending more time doing things that were easy in react. You get these posts from industry experts that tell you the BEST way to do something. I don’t doubt that, but sometimes dev time gets lost when we just focus on the most semantic and performant way to do everything.(1/2)

# Posted by Chris Hayes on Thursday, November 9th, 2023 at 6:59pm

Brantley Harris

@chris_hayes @zachleat

There’s a learning curve for sure, but once you start getting into it you realize how much React separates you from good ways of doing things. It’s giving you an abstraction, but it’s no longer needed.

Lit is amazing coming from React. You don’t get to do hooks, some other WC frameworks have those. But honestly once you simplify everything like Lit, you just don’t need them. In fact, there is so much I just don’t need with Lit and WCs, and that’s what it’s really about.

Ian Tindale

@[email protected] is there any way of using these without JavaScript? I was interested when I first heard about these but was immediately disappointed to discover that they’re not really just markup, they’re always dependent on programming as far as I can see

# Posted by Ian Tindale on Thursday, November 9th, 2023 at 7:46pm

Richard Dallaway

@jonoabroad @adactio like many others [citation needed] I’ve enjoyed not using frameworks and not having to update code to keep up to date. Web components keep it manageable. My language snobbery means I needs a Typescript build step but it’s my code and I can understand it.

Tane Piper

@adactio (FWIW the best Web Components I’ve released have been ones to create a musical keyboard, and one to wrap forms that make them dynamic - neither of them UI components)

# Posted by Tane Piper on Thursday, November 9th, 2023 at 11:04pm

Ian Tindale

@[email protected] @[email protected] the HTML Modules bit looks excellent – at the moment it’s impossible to build a website like I used to be able to teach people how to do in 1997, because we can’t put the navigation buttons inside a frame because we can’t have frames and we can’t import anything in htmlCurrently I’m trying to do exactly that in svg with foreign object to bring in xhtml bits of body copy, and have the navigation as another foreignObjectI like the way that in SVG I can avoid the need to know someone who knows how to write programs, by using eg for animation the SMIL words – they’re understandable

# Posted by Ian Tindale on Friday, November 10th, 2023 at 6:20am

Eric Newport

@u0421793 @adactio @trusktr I have similar feelings. I’ve always felt React was over-engineering when the native web is so powerful, but I’ve also always felt web components were *also* over-engineering, just less so.

Can anyone here explain to me why I would want to use a web component for any use case at all instead of just progressively enhancing some markup with CSS and JS the old-fashioned way? What is the benefit to destroying the CSS cascade and whatnot?

Patrick Smith

@adactio Great post. I prefer the term “custom HTML elements” because like you say it’s about introducing new primitives. Reusable “atoms” in the Atomic design parlance.

And components or partials would still exist, they wrap elements: both custom and built-in elements. They are the molecules and organisms in Atomic design.

Joe Pea

@kethinov @u0421793

☝️Did you read @adactio’s article? You don’t have to destroy the CSS cascade or use Shadow DOM. Shadow DOM is optional. It depends what you’d like to do.

The following is progressive enhancement where the wrapper custom element adds additional features:

<super-slider> <label>…</label> <input … /></super-slider>

# Posted by Joe Pea on Saturday, November 11th, 2023 at 11:27pm

Joe Pea

@kethinov @u0421793 @adactio

This is clean because now you can easily stamp the progressive enhancement where you need it, and the code is less book-keepy, instead it operates in the location where you place it, colocated with the HTML it operates on.

This is alternative to having the <input> inside ShadowDOM and mapping attributes to it, which gets complicated, and blocks outside CSS. So what you’re asking about is what that article covers.

https://meyerweb.com/eric/thoughts/2023/11/01/blinded-by-the-light-dom/

https://aaadaaam.com/notes/step-into-the-light-dom/

Blinded By the Light DOM

# Posted by Joe Pea on Saturday, November 11th, 2023 at 11:28pm

Joe Pea

@kethinov @u0421793 @adactio

You could do similar with jQuery for example, but then you have to manually keep track of when elements are added and removed from the DOM to apply logic to them. With Custom Elements, they instantiate and run at the location where they are without that book keeping.

And without Shadow DOM, you traditional CSS style at the document level works the same way.

# Posted by Joe Pea on Saturday, November 11th, 2023 at 11:30pm

Joe Pea

@kethinov @u0421793 @adactio

Maybe jQuery does the book keeping, I don’t remember. But with vanilla JS you’d need MutationObserver to effectively re-create what we get for free with connectedCallback and other methods.

# Posted by Joe Pea on Saturday, November 11th, 2023 at 11:31pm

blog.jim-nielsen.com

I think the word “component” in “web components” confused a lot of people — at least it did me.

“Web components” sounded like the web platform’s equivalent to “React components”. JSX had <MyComponent> and now the web had <my-component>.

But when you try building web components the same way you build React components, it’s easy to get frustrated and give up because web components don’t work like React components — I know I gave up a few times.

The grain of a React component is not the grain of a web component. Their design prioritize different functionality and forms of use. If you try to use one like the other, you’ll fight the direction of their natural grain.

Web components have their own grain and it favors enhancement over replacement. What do I mean by this?

A typical React component might look like this[1]:

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

You could write a web component this same way, e.g.

<user-avatar src="https://example.com/path/to/img.jpg" alt="..."
></user-avatar>

But the unique power of web components (in the browser) is that they can render before JavaScript. React components cannot do this — full stop.

This feature of web components encourages a design of composability. Rather than an empty “shell component” that takes data and (using JavaScript exclusively) renders the entirety of its contents, web components encourage an approach of composing core content with HTML and then wrapping it in a custom element that enhances its contents with additional functionality.

<user-avatar> <img src="https://example.com/path/to/img.jpg" alt="..." />
</user-avatar>

This specific flavor of componentization is what Jeremy calls “HTML web components”:

If your custom element is empty, it’s not an HTML web component. But if you’re using a custom element to extend existing markup, that’s an HTML web component.

React encouraged a mindset of replacement: “forgot what browsers can do; do everything in a React component instead, even if you’re reinventing the wheel.”

HTML web components encourage a mindset of augmentation instead.

I like that term “HTML web component”. It stands in contrast to a “JavaScript web components” which would be an empty element whose functionality and contents rely exclusively on JavaScript.

Per my earlier example, this would be a JavaScript web component:

<user-avatar src="https://example.com/path/to/img.jpg" alt="..."
></user-avatar>

It relies exclusively on the presence of JavaScript and is meaningless to the end user without it.

Whereas this would be an HTML web component:

<user-avatar> <img src="https://example.com/path/to/img.jpg" alt="..." />
</user-avatar>

It has meaning and content without JavaScript — then is enhanced by its presence.

This idea of augmentation/enhancement over replacement is intriguing.

On The Web, Augmentation Wins in the Long Run

Augmentative approaches work best on the web because 1) the web’s grain encourages enhancement to improve resilience, and 2) that’s really the best way to iteratively change something as big as the web.

Eventually all the best ideas of web-adjacent frameworks are subsumed into the platform to work in ways that augment the existing technology rather than replace it wholesale.

XHTML wanted to replace HTML4, but HTML5 wanted to augment it. HTML5 won.

Networking libraries wanted to replace XMLHttpRequest and their best ideas were eventually ported into the fetch standard — which exists in more places than just the browser these days!

The best ideas of Sass and jQuery were ported to the browser.

Typescript’s best ideas are going to the browser, but in a way that works to enhance not replace what exists.

With web components, you might even say React’s component model is being ported to the browser. But it’s being done in a way that works to enhance how the web already works, not replace it.

My takeaway is: if you’re looking for longevity, opt for a technical approach of augmentation and enhancement over replacement. The web’s grain is arranged in that direction.

  1. I think React is trending towards becoming more like HTML over the years. Dan Abramov notes how component composition over prop drilling is a “top react skill to learn in 2023”. Even the react docs specifically call out the composability of HTML and how you might want to follow HTML’s example in your JSX.

# Monday, November 13th, 2023 at 7:00pm

Miriam (still)

@zachleat @adactio.com @jimniels I went all in on the name for my post, while also throwing it some shade in the title (and literal ouroboros side-eye in the hero image). What am I going to do, argue with an entire week of tradition? 😅

Russell Garner

@tosbourn “So long as it’s HTML first code, designed to work with standard web tech” — W3C pretty much the only resourced game in town without some agenda parallel to that

Mathieu

@mxbck “using custom elements to attach functionality to a specific kind of component.” The best part of this approach for me is the scoping of DOM references. Nice article, thanks for sharing! 🤗

# Posted by Mathieu on Friday, December 1st, 2023 at 11:51pm

Jouni Kantola

@mxbck Care to elaborate? I’m curious how this approach is different from using querySelector and enhancing elements? If it’s reusability, I’m still on the fence.

nolanlawson.com

Shadow DOM and the problem of encapsulation

# Friday, February 2nd, 2024 at 1:20pm

daverupert.com

A common web component learning blunder

# Tuesday, May 28th, 2024 at 3:44pm

Marco Rogers

@KevinMarks @adactio.com yeah I found this really compelling. My biggest questions are around accessibility. I think one of the reasons we wanted shadow dom to work is that it helps screen readers not get bogged down in reading extraneous markup?

54 Shares

# Shared by Kristofer Joseph on Thursday, November 9th, 2023 at 6:23pm

# Shared by Eric A. Meyer on Thursday, November 9th, 2023 at 6:23pm

# Shared by Aslak Raanes on Thursday, November 9th, 2023 at 6:24pm

# Shared by E.W. Doc Parris on Thursday, November 9th, 2023 at 6:24pm

# Shared by The Spicy Web on Thursday, November 9th, 2023 at 6:24pm

# Shared by Stephen Bell on Thursday, November 9th, 2023 at 6:24pm

# Shared by Stedi :bassguitar: 🎸 🎼 🦅 🚴 on Thursday, November 9th, 2023 at 6:24pm

# Shared by Adrian McEwen on Thursday, November 9th, 2023 at 6:24pm

# Shared by rem on Thursday, November 9th, 2023 at 6:24pm

# Shared by David G. Smith on Thursday, November 9th, 2023 at 6:51pm

# Shared by John Allsopp on Thursday, November 9th, 2023 at 6:51pm

# Shared by Diewy on Thursday, November 9th, 2023 at 6:51pm

# Shared by Hermann Dettmann on Thursday, November 9th, 2023 at 6:51pm

# Shared by Zach Leatherman on Thursday, November 9th, 2023 at 6:51pm

# Shared by tomhazledine on Thursday, November 9th, 2023 at 6:51pm

# Shared by Thomas Michael Semmler on Thursday, November 9th, 2023 at 6:51pm

# Shared by Peter Richardson on Thursday, November 9th, 2023 at 7:27pm

# Shared by Jesper on Thursday, November 9th, 2023 at 7:27pm

# Shared by Pavel Zinoviev 👾 on Thursday, November 9th, 2023 at 7:27pm

# Shared by Eric on Thursday, November 9th, 2023 at 7:27pm

# Shared by Tim van der Lippe on Thursday, November 9th, 2023 at 8:00pm

# Shared by Richard Livsey on Thursday, November 9th, 2023 at 8:00pm

# Shared by Sona on Thursday, November 9th, 2023 at 8:00pm

# Shared by Peter Janes on Thursday, November 9th, 2023 at 8:00pm

# Shared by Simon Skoczylas on Thursday, November 9th, 2023 at 8:00pm

# Shared by Tiota Sram on Thursday, November 9th, 2023 at 8:24pm

# Shared by Dave Rupert on Thursday, November 9th, 2023 at 9:00pm

# Shared by Thomas Peklak on Thursday, November 9th, 2023 at 9:00pm

# Shared by Symfony Station :symfony: on Thursday, November 9th, 2023 at 9:00pm

# Shared by Simon MacDonald on Thursday, November 9th, 2023 at 10:32pm

# Shared by Matt Singletary on Thursday, November 9th, 2023 at 10:59pm

# Shared by Holger Hellinger on Thursday, November 9th, 2023 at 10:59pm

# Shared by Simon Praetorius on Thursday, November 9th, 2023 at 11:59pm

# Shared by Nicöd·e on Friday, November 10th, 2023 at 12:36am

# Shared by Jon on Friday, November 10th, 2023 at 1:09am

# Shared by Alan Dávalos on Friday, November 10th, 2023 at 3:28am

# Shared by Michael Sean Becker on Friday, November 10th, 2023 at 3:59am

# Shared by Warren Buckley on Friday, November 10th, 2023 at 7:36am

# Shared by Téotime Pacreau on Friday, November 10th, 2023 at 8:41am

# Shared by RT bot :blobcheer: on Friday, November 10th, 2023 at 10:43am

# Shared by Patrick Brosset on Friday, November 10th, 2023 at 1:10pm

# Shared by Bertrand Delacretaz on Friday, November 10th, 2023 at 1:10pm

# Shared by Chris Taylor on Friday, November 10th, 2023 at 1:10pm

# Shared by Carlos Noguera on Friday, November 10th, 2023 at 1:37pm

# Shared by Timo Häkkinen on Friday, November 10th, 2023 at 2:13pm

# Shared by Bruce B Anderson on Monday, November 13th, 2023 at 12:30am

# Shared by Mario on Monday, November 13th, 2023 at 5:53am

# Shared by georapbox on Tuesday, November 14th, 2023 at 9:38pm

# Shared by Felipe Kinoshita on Wednesday, November 15th, 2023 at 7:44am

# Shared by HappiePlant :flow: on Wednesday, November 15th, 2023 at 10:37am

# Shared by divdev on Wednesday, November 15th, 2023 at 7:26pm

# Shared by Evil Jim O’Donnell on Sunday, November 19th, 2023 at 11:13am

# Shared by 北市真 on Sunday, November 19th, 2023 at 3:17pm

# Shared by Halvor William Sanden on Wednesday, November 22nd, 2023 at 8:27am

65 Likes

# Liked by Adam Perfect on Thursday, November 9th, 2023 at 6:22pm

# Liked by Zach Leatherman on Thursday, November 9th, 2023 at 6:22pm

# Liked by sumarstrákur on Thursday, November 9th, 2023 at 6:22pm

# Liked by Kristofer Joseph on Thursday, November 9th, 2023 at 6:23pm

# Liked by Eric A. Meyer on Thursday, November 9th, 2023 at 6:23pm

# Liked by Aslak Raanes on Thursday, November 9th, 2023 at 6:23pm

# Liked by Annika Backstrom on Thursday, November 9th, 2023 at 6:23pm

# Liked by Philip Newborough on Thursday, November 9th, 2023 at 6:23pm

# Liked by E.W. Doc Parris on Thursday, November 9th, 2023 at 6:23pm

# Liked by Paul 🏴‍☠️ on Thursday, November 9th, 2023 at 6:23pm

# Liked by Stedi :bassguitar: 🎸 🎼 🦅 🚴 on Thursday, November 9th, 2023 at 6:23pm

# Liked by David G. Smith on Thursday, November 9th, 2023 at 6:50pm

# Liked by ℵancym on Thursday, November 9th, 2023 at 6:50pm

# Liked by Jay Contonio on Thursday, November 9th, 2023 at 6:50pm

# Liked by sam (best friend) on Thursday, November 9th, 2023 at 6:51pm

# Liked by Luke Dary on Thursday, November 9th, 2023 at 6:51pm

# Liked by Molly B on Thursday, November 9th, 2023 at 6:51pm

# Liked by tomhazledine on Thursday, November 9th, 2023 at 6:51pm

# Liked by Luke Dorny on Thursday, November 9th, 2023 at 6:51pm

# Liked by Peter Janes on Thursday, November 9th, 2023 at 7:26pm

# Liked by Jesper on Thursday, November 9th, 2023 at 7:26pm

# Liked by Tod Robbins on Thursday, November 9th, 2023 at 7:26pm

# Liked by Cesare Pautasso on Thursday, November 9th, 2023 at 7:27pm

# Liked by Brian Schlining :verified: on Thursday, November 9th, 2023 at 7:27pm

# Liked by Tim van der Lippe on Thursday, November 9th, 2023 at 7:59pm

# Liked by Ian Tindale on Thursday, November 9th, 2023 at 8:00pm

# Liked by Corstian Boerman on Thursday, November 9th, 2023 at 8:00pm

# Liked by Simon Skoczylas on Thursday, November 9th, 2023 at 8:00pm

# Liked by fLaMEd on Thursday, November 9th, 2023 at 8:00pm

# Liked by Dave Rupert on Thursday, November 9th, 2023 at 8:24pm

# Liked by Tiota Sram on Thursday, November 9th, 2023 at 8:24pm

# Liked by Mike Aparicio on Thursday, November 9th, 2023 at 8:24pm

# Liked by Roma Komarov on Thursday, November 9th, 2023 at 8:24pm

# Liked by Ashur Cabrera on Thursday, November 9th, 2023 at 9:00pm

# Liked by Jacob Rask on Thursday, November 9th, 2023 at 9:34pm

# Liked by felix (grayscale) 🐺 on Thursday, November 9th, 2023 at 9:34pm

# Liked by Sue on Thursday, November 9th, 2023 at 10:02pm

# Liked by saiot on Thursday, November 9th, 2023 at 10:32pm

# Liked by Holger Hellinger on Thursday, November 9th, 2023 at 10:59pm

# Liked by Mauro on Friday, November 10th, 2023 at 12:35am

# Liked by Justin Mecham on Friday, November 10th, 2023 at 12:35am

# Liked by Jon on Friday, November 10th, 2023 at 1:09am

# Liked by gorsefan on Friday, November 10th, 2023 at 1:40am

# Liked by Random Forest Web on Friday, November 10th, 2023 at 2:35am

# Liked by zane on Friday, November 10th, 2023 at 3:59am

# Liked by Seth A. Roby on Friday, November 10th, 2023 at 4:52am

# Liked by Joe Pea on Friday, November 10th, 2023 at 4:52am

# Liked by Sven Kaemper on Friday, November 10th, 2023 at 7:08am

# Liked by Michael Hitzler on Friday, November 10th, 2023 at 7:08am

# Liked by Warren Buckley on Friday, November 10th, 2023 at 7:36am

# Liked by Chris Taylor on Friday, November 10th, 2023 at 1:09pm

# Liked by Carlos Noguera on Friday, November 10th, 2023 at 1:37pm

# Friday, November 10th, 2023 at 2:12pm

# Liked by bkardell on Friday, November 10th, 2023 at 2:13pm

# Liked by Robert Katzki on Friday, November 10th, 2023 at 2:46pm

# Liked by dovyden on Friday, November 10th, 2023 at 10:02pm

# Liked by jake lazaroff on Saturday, November 11th, 2023 at 5:41am

# Liked by peter royal on Saturday, November 11th, 2023 at 6:10am

# Liked by Mario on Monday, November 13th, 2023 at 5:53am

# Liked by georapbox on Tuesday, November 14th, 2023 at 9:38pm

# Liked by Felipe Kinoshita on Wednesday, November 15th, 2023 at 7:44am

# Liked by Cassio Pereira on Wednesday, November 15th, 2023 at 9:13am

# Liked by divdev on Wednesday, November 15th, 2023 at 7:25pm

# Liked by Evil Jim O’Donnell on Sunday, November 19th, 2023 at 11:13am

# Liked by 北市真 on Sunday, November 19th, 2023 at 3:16pm

Related posts

Web App install API

It’s kind of ridiculous that this functionality doesn’t exist yet.

Applying the four principles of accessibility

Here’s how I interpret the top-level guidance in the Web Content Accessibility Guidelines.

Hanging punctuation in CSS

A little fix for Safari.

Of the web

Baldur Bjarnason has written my mind.

The principle of most availability

Reframing the principle of least power.

Related links

How to build a simple Camera component - Frontend News #4

A step-by-step guide to wrapping up a self-contained bit of functionality (a camera, in this case) into a web component.

Mind you, it would be nice if there were some thought given to fallbacks, like say:

<simple-camera>
<input type="file" accept="image/*">
</simple-camera>

Tagged with

005: Service workers - Web Components Club

I strongly recommend that you read Going Offline by Jeremy Keith. Before his book, I found the concept of service workers quite daunting and convinced myself that it’s one of those things that I’ll have to set aside a big chunk of time to learn. I got through Jeremy’s book in a few hours and felt confident and inspired. This is because he’s very good at explaining concepts in a friendly, concise manner.

Tagged with

Shadow DOM: fast and encapsulated styles – Monica Dinculescu

Monica explains how Shadow DOM could be the perfect answer for scoping CSS:

We didn’t have style encapsulation, so we started naming things “the right way” with BEM, so that we didn’t accidentally stomp over each other’s styles. We wanted to be able to author CSS from inside a JavaScript component, so we started using CSS-in-JS. We needed all these tools, because “the platform” (read: the browsers that be) wasn’t there, and building these tools showed that there was a need to move forward. For style encapsulation, Shadow DOM is the platform moving forward.

Although, in a way, Shadow DOM is also another flavour of CSS-in-JS:

Before you complain that using a Shadow DOM and Web Components means that it absolutely requires JavaScript: this is true.

Tagged with

How Will Web Components Change CSS Architecture? - Snook.ca

Depending on how you’re currently structuring your CSS and class attributes, web components might not make all that much of a difference to your workflow.

Tagged with

Extensible Web Summit Berlin 2014: my lightning talk on Web Components | soledad penadés

Soledad Penadés also went to the Extensible Web Summit in Berlin, where she gave a lightning talk. Sounds like it was really good.

This also includes some good advice that, again, Alex might want to consider before denouncing any disagreement on Web Components as “piffle and tosh”:

If the W3C, or any other standardisation organisation wants to attract “normal” developers to get more diverse inputs, they/we should start by being respectful to everyone. Don’t try to show everyone how superclever you are. Don’t be a jerk. Don’t scare people away, because then only the loud ones stay, and the quieter shy people, or people who have more urgent matters to attend (such as, you know, having a working business website even if it’s not using the latest and greatest API) will just leave.

Tagged with

Previously on this day

4 years ago I wrote Bookshop

Manually machine tagging books as a kind of mindless meditation.

13 years ago I wrote Responsible responsive images

A future-friendly approach to mobile-first responsive design.

17 years ago I wrote Berlin, day 4

Less expo, more Berlin.

18 years ago I wrote Put your money where Joe Clark’s mouth is

Joe finds me patronising.

20 years ago I wrote Party on, dudes

I’m a torn geek tonight. I was tempted to stay in and watch the new show on BBC that should be called Walking With Planets. In the end, I decided to come out to a WiFi pub for a Firefox release party.

20 years ago I wrote Alive, alive-o!

Maybe it’s just because I was visiting the city recently, but I’m getting a real kick out of this Dublin-based blog, Twenty Major.

21 years ago I wrote Photoshop actions

I’ve put together a new article. It’s basically a rundown of some Photoshop actions I use to create nice photographic effects.

22 years ago I wrote Wow!

When I got up yesterday morning, Jessica asked me if had dreamt nice dreams.

23 years ago I wrote Kaese Spaetzle

Catherine, our drummer, is coming over tomorrow night. Chris and Karin are going to cook up some kaese spaetzle.

23 years ago I wrote Satellite on a shoestring going strong

Nasa could learn a thing or two from the U.S. Naval Academy Alumni Association. One month after the clever folks in Maryland launched a satellite built for just $50,000 (instead of the originally anticipated $1,000,000), the satellite shows no sign of deg