@LorenzKahl @jensimmons @mozilla I don't spend much time looking into Reader Mode, so I've not noticed this. When you're delivering content via DSD, are you later upgrading those #customElements or simply using #declarativeShadowDOM? The influence of JS in that area would surprise me less, even if it were still not the optimal behavior in that case...

😅

@jensimmons @westbrook @mozilla is it a known issue that Safari & Firefox Reader Mode ignore content rendered by Web Components in the Shadow DOM - even SSR‘ed content using DSD (iOS & Mac)

#WebComponents #DeclarativeShadowDOM #DSD #SSR

New Kitten release

• Now leaves <style> tags within <template> tags alone when collating and normalising the CSS on a page so as not to interfere with scoped styles in declarative shadow DOM.

(Kitten’s Streaming HTML workflow¹ – which uses htmx and WebSockets under the hood – combined with built-in support for slots, etc., in Kitten components² means the use of declarative shadow DOM is mostly useful if you want scoped styles. Ideally, of course, use classes to scope styles to your components and be specific in your CSS selectors in general so as not to pollute elements in your components. Although that’s a bit like saying you should floss everyday. Yeah, we all know we should…) :)

Update: All that said, I’d highly recommend you don’t use Shadow DOM in your Kitten apps. For one thing, htmx’s WebSocket extension doesn’t seem to play well with it. And for another, you really don’t need it and definitely not just to get scoped CSS.

Enjoy!

💕

¹ https://kitten.small-web.org/tutorials/streaming-html/
² https://kitten.small-web.org/tutorials/components-and-fragments/

#Kitten #SmallWeb #SmallTech #CSS #CSSScoping #ShadowDOM #shadowRoot #DOM #HTML #JavaScript #JS #style #template #declarativeShadowDOM #NodeJS #web #dev

Relatively New Things You Should Know about HTML Heading Into 2025 – Frontend Masters Blog

Accordion details, toggle switches, styleable selects, responsive video, and more!

Using #DeclarativeShadowDOM to render placeholder content that gets replaced later as the #HTML #streams in with no #JavaScript!

https://lamplightdev.com/blog/2024/01/10/streaming-html-out-of-order-without-javascript/

This is an interesting technique, but it has limitations in that you can't close the #customElement until you've loaded the content.

#webDev #shadowDom #webComponents #customElements #http #streaming #web #frontend

lamplightdev - Streaming HTML out of order without JavaScript

Chris Haynes - web developer consultant

@ryantownsend In https://github.com/WICG/webcomponents/issues/939 we're theorizing the declarative sharing of repeat <style> tags. Structured initially for #declarativeShadowDOM, but feels like something that could apply to prelude-less @​scope, too. I wonder if that would make it practical/productive to blend test no. 1 and no. 3 in your demo https://css-scope-test.netlify.app/ and whether an approach that like that could even further reduce the paint times these tests are clocking...

So many great encapsulation strategies, so little time!

<style>
p {
color: blue;
font-size: 2rem;
}
</style>

<my-el>
<style>
@Scope {
:scope {
&, * {
all: revert-layer;
color: red;
}
}
}
</style>
<p>This text is red & small!</p>
</my-el>

<my-el>
<template shadowrootmode="open">
<style>
* {
color: red;
}
</style>
<p>This text is red & small!</p>
</template>
</my-el>

https://codepen.io/Westbrook/pen/vYMgOyZ?editors=1000

#CSSScope #shadowDOM #declarativeShadowDOM #webDev

Encapsulation Part!

...

Released v3 of Tram-Deco, the declarative custom element library that uses #DeclarativeShadowDOM (which became available in all major browsers this week)!

https://github.com/Tram-One/tram-deco

I also added an import method, which allows you to import definitions from other HTML files (relies on `Document.parseHTMLUnsafe`, so millage may vary).

Planning to present this to Web Components Community Group, so I would love any feedback! ❤️

#WebComponents #WebDev #HTML #HTMLFirst #ShadowDOM

GitHub - Tram-One/tram-deco: 🏢 Declarative Custom Elements using native Web Component APIs and specs.

🏢 Declarative Custom Elements using native Web Component APIs and specs. - Tram-One/tram-deco

GitHub

@nshki OMG, I'm so happy, this makes testing random weirdnesses of the various shadow DOMs so, so, so much easier!

Like: https://codepen.io/Westbrook/pen/OJqrxym

...now we can side eye #Chrome even more for their weird support of :has() inside of :host(). 🥳

#webComponents #shadowDOM #declarativeShadowDOM #webComponentsCG

:host(:has(...))

...

Put together a super lightweight and standard-API-focused implementation of Declarative Custom Elements. 👏

https://github.com/Tram-One/tram-deco

Exclusively implements all the standard Web Component APIs in an HTML-First approach that should be familiar and easy to pick up 😁 - no special syntax or template language here.

Check the repo for live codepens, and would love to hear what people think! ❤️

#WebComponents #WebDev #HTMLFirst #DeclarativeShadowDOM #ShadowDOM #HTML

GitHub - Tram-One/tram-deco: 🏢 Declarative Custom Elements using native Web Component APIs and specs.

🏢 Declarative Custom Elements using native Web Component APIs and specs. - Tram-One/tram-deco

GitHub