#shadowroot — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #shadowroot, aggregated by home.social.
-
#css svg wizards
I know I can change the property of an svg’s inner element that’s in a <use>d shadow DOM via a custom property:
```
<svg class="icon"…
<use>
#shadowroot
<symbol…
<path style="opacity: var(--icon-opacity"…
```But how do I impose a transition on the change?
.icon use path {transition: opacity 0.5s;}
…seems not to work 🤔
-
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!
:kitten:💕
¹ 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
-
Is it possible to access a closed #ShadowRoot on a non-custom element?
```
<div>
<template shadowrootmode="closed">
...
</template>
</div>
```The only ways I'm aware of are `HTMLElement.prototype.attachInternals` which requires a custom element or to manually attach the root with `Element.prototype.attachShadow` and save the result. Are those the only two ways to get at a closed root?
-
I 💜 #webComponents but I'm not a fan of the #shadowRoot bc I usually _want_ styles to be inherited. I've read that you can include the same stylesheet again inside the SR but that's got to add a lot of processing. I read lots of other hackish solutions too.
Anyway, I've had some success just using the light side - regular #dom nodes. I built a wrapper around <progress> to do nice animations & reporting current task, too. And another to make #privacy friendly social media share btns.
#webDev -
Is there any browser form filler extension that can auto fill random data into inputs that live inside #shadowroot?