profile

That HTML Blog

That HTML Blog #16: Scaling up imperative DOM APIs, utility-first CSS fails, safe DSD

Published 3 months ago • 2 min read

Friday, February 23, 2024

Web development news seemed sluggish earlier this month (plus I spent the better part of February very sick!), but now I'm seeing things picking up again—not the least of which is that Firefox 123 is out which finally offers native support for Declarative Shadow DOM (DSD)! Now we can state with confidence that all modern browsers support DSD, and the days of reaching for a polyfill are numbered. 🎉

There's also been a ton of content and conversation floating about concerning the "future of the Jamstack" (including an upcoming interview I participated in which was very enjoyable), so we'll likely touch on that in a big way come March. For folks like me who've always felt the real promise of Jamstack approaches to web development was the intentional focus on static-first, HTML-first solutions, that should fit right in at That HTML Blog.

’Till next time,
Jared


The DX Limitations of Imperative APIs

In this essay at Smashing Magazine, Frederik Dohr walks through some of the challenges of scaling up purely “imperative” DOM APIs inside a web component to handle complex UI state and rendering. Now I happen to think there can be a wide spectrum of approaches and third-party solutions here. Imagine vanilla JavaScript all the way on one end of the spectrum, and React all the way on the other end of the spectrum. There’s a lot of room in the middle for light-weight tools which can address low-hanging fruit.

Read on the web…


Utility-First CSS Does a Disservice to Utilities

In this addition to the corpus of critiques of “utility-first” CSS, Heydon Pickering does an excellent job of explaining the strange world we find ourselves in where the C of CSS is simply being thrown away for the sake of a convenience that doesn’t actually end up very convenient at all in the long run.

Read on the web...


Variable Font Face Made Easy

I’ve set up @font-face rules and styling for variable fonts in the past, but I recall dealing with some fiddly bits that sort of turned me off from reaching for variable fonts as a default approach.

Well, in this example of how Michelle Barker got things set up for her site in a recent redesign, it seems very straightforward and makes a lot of sense.

Read on the web…


Practice Safe DSD with setHTMLUnsafe (It’s Complicated 😂)

All right, so you got your web server emitting some HTML with declarative shadow DOM (DSD). Great! You fetch a fragment of this HTML, and use innerHTML to set an element to display this new HTML.

Uh oh.

No worries, you think to yourself. You’ll use DOMParser.parseFromString to construct a new fragment from the server-provided string, and then append that to your page. Surely that will work!

Uh oh.

Yes, I’m sorry be the bearer of bad news, but the typical DOM APIs you use to turn strings of HTML into new DOM do not parse DSD. All those <template shadowrootmode="…"> tags remain just that, template tags. No shadow DOM to be found anywhere.

Until now.

Read on the web…


That HTML Blog
Made with ❤️ in Portland, Oregon

See also our sibling publication The Spicy Web + Discord
Follow The Spicy Web on Mastodon!

That HTML Blog

That HTML Blog is the fresh place to be for posts about developing websites & applications using “vanilla” & standards-adjacent web technologies.

Get this: a weekly digest of thrilling links sent right to your inbox. w00t! 🙌

Read more from That HTML Blog

Friday, April 19, 2024 Here in Portland, spring is in full bloom 🌸, and what is also in full bloom is the effort to (see what I did there?) equalize the rollout of awesome new web specs across all browsers. I am of course talking about Interop 2024, and who better to discuss these exciting developments for #WebDev with than my good friend Ayush. That's right my friends, Just a Spec is back! 👏 And in 🎙️ Episode 14 of Just a Spec, we pulled out some of our favorite focus areas from the Interop...

about 1 month ago • 1 min read

Friday, March 29, 2024 Hello Web friends! I've been a busy beaver this month. We kicked off the version 2 development cycle of Bridgetown, a site generator & fullstack framework I help maintain, and I've been deep in the throes of that effort. In addition, I launched (rebooted in a way) a new general fediverse-friendly tech blog called The Internet Review. It draws from various archives I have stretching all the way back to 1996! (gawd I feel old now. 😋) But you're here to talk #WebDev, so...

about 2 months ago • 2 min read

Friday, March 8, 2014 In a World… …Where No Selectors Can Be Applied Based on a Single Variable Value… …One Specification Emerges…One Which Will Change Everything… …And That Specification Is… Container Style Queries. 💥 All right, well maybe this doesn't rise to the excitement level of an 80s action movie, but I think it's pretty amazing. Read below to learn how you can add superpowers to your CSS variables. I also talk about a fresh look at the question of if "Jamstack" can be rehabilitated...

2 months ago • 1 min read
Share this post