Re: [WICG/webcomponents] "open-stylable" Shadow Roots (#909)

Forgive me if this has been recommended and I missed it, but it seems like the issue isn’t so much about styles specifically, but that Shadow DOM was originally built as an all-or-nothing API. This recommendation seeks to allow disabling a feature in the same way that `mode: "open"` did. What if, instead of debating how to allow people to opt out, we instead look at a way to make Shadow DOM features individually opt-in with feature flags? We could treat `mode` more akin to `<iframe>`’s `sandbox` attribute.

```js
host.attachShadow({ mode: 'encapsulate-ids encapsulate-events encapsulate-styles' });
```

```html
<template shadowdommode=“encapsulate-ids encapsulate-events encapsulate-styles”>
```

This also allows for solving the current need for granular control of encapsulation and opens the door for future additional Shadow DOM features without breaking backwards compatibility or declarative usage.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/909#issuecomment-1937380036
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/909/1937380036@github.com>

Received on Sunday, 11 February 2024 01:10:53 UTC