Testing HTML Light DOM Web Components: Easier Than Expected!

Testing HTML Light DOM web components wasn't so scary after all. Some testing notes and patterns from a recent project.

Cloud Four

#Development #Explorations
Isomorphic web components · Who says web components can’t be rendered server-side? https://ilo.im/161cdx

_____
#WebComponents #WebPlatform #WebDev #Frontend #LightDOM #ShadowDOM #HTML #JavaScript #Backend #Server

Isomorphic Web Components | jakelazaroff.com

The lack of server-side rendering in web components has become a sort of folk belief that oft goes unquestioned. I am happy to report that the fears are unfounded.

#Development #Techniques
Combining light DOM and shadow DOM · How to mix-and-match both in a web component https://ilo.im/160yn2

_____
#WebComponents #LightDom #ShadowDom #Frontend #HTML #CSS #JavaScript

Combining light DOM and shadow DOM in a Web Component

For the last few weeks, I’ve been complaining about the shadow DOM. As much as I think it’s an anti-pattern, there are some times where the shadow DOM can be situationally useful. Today, I wanted to show you how you can mix-and-match the light DOM and the shadow DOM in a single Web Component. Let’s dig in! Our Web Component Let’s imagine we have a <count-up> custom element… <count-up></count-up> When our Web Component JavaScript instantiates, it renders into a <button>, and a [role="status"] element that displays how many times the <button> has been clicked…

🟣 Combining light DOM and shadow DOM in a Web Component

by @cferdinandi.bsky.social

#lightDOM #shadowDOM #WebComponent #webdev

https://gomakethings.com/combining-light-dom-and-shadow-dom-in-a-web-component/

Combining light DOM and shadow DOM in a Web Component

For the last few weeks, I’ve been complaining about the shadow DOM. As much as I think it’s an anti-pattern, there are some times where the shadow DOM can be situationally useful. Today, I wanted to show you how you can mix-and-match the light DOM and the shadow DOM in a single Web Component. Let’s dig in! Our Web Component Let’s imagine we have a <count-up> custom element… <count-up></count-up> When our Web Component JavaScript instantiates, it renders into a <button>, and a [role="status"] element that displays how many times the <button> has been clicked…

HTML Web Components Can Have a Little Shadow DOM, As A Treat | Scott Jehl, Web Designer/Developer

Shadow DOM and Slots can be part of a progressive enhancement strategy, actually.

#Development #Approaches
Web components without jumping from 0 to 100 · How you can start small with custom HTML elements https://ilo.im/15z83x

_____
#WebComponent #ShadowDOM #LightDOM #ProgressiveEnhancement #Browser #WebDev #Frontend #HTML #JavaScript

Web components without having to go instantly from 0 to 100 | Sjors Rijsdam, front-end developer

Sjors Rijsdam is a front-end developer from the Netherlands. He loves to build fast, beautiful and standards based websites.

#Development #Clarifications
Shadow DOM and the problem of encapsulation · Shadow DOM’s accomplishment in web components https://ilo.im/15xjkz

_____
#WebComponent #ShadowDOM #LightDOM #WebDev #Frontend #HTML #JavaScript

Shadow DOM and the problem of encapsulation

Web components are kind of having a moment right now. And as part of that, shadow DOM is having a bit of a moment too. Or it would, except that much of the conversation seems to be about why you sh…

Read the Tea Leaves

#Development #Techniques
Shadow DOM is for hiding your shame · Light DOM is for the ideal, perfect structure. https://ilo.im/15i68u

_____
#WebComponent #ShadowDOM #LightDOM #HtmlWebComponent #WebDev #Frontend #HTML #JavaScript

Shadow DOM is for hiding your shame

Web Components | 12 Days of Web

Learn how to build custom HTML elements that manage their own lifecycle, state and behaviors, both with and without shadow DOM.

"With a traditional HTML component, any developer who uses it will need to update their HTML, JavaScript, and CSS files to include the fix. With web components, they only have to update the JavaScript file."

https://www.htmhell.dev/adventcalendar/2023/6/

Very straightforward #WebComponents example by @cferdinandi by showing how to create the (classic?) counter button.

#HTML #JavaScript #WebDev #Frontend #ShadowDOM #LightDOM

Web Components FTW! - HTMHell

A collection of bad practices in HTML, copied from real websites.

Web Components FTW! - HTMHell