Re: [whatwg/dom] Declarative Shadow DOM (#831)

> > Would declarative shadow DOM be still a useful primitive when we have declarative custom elements? If so, why? What concrete use cases would it address better than declarative custom elements?
> 
> Definitely yes, I think. People have been asking for style isolation for _years_, and adding a shadow is the simplest way to do so with the existing primitives in the platform. And style isolation is useful at a general "distinct parts of the page" level; requiring people to promote their element to a (single-use?) custom element to get this effect seems gratuitous. No matter how easy we make declarative custom elements, they'll always be additional steps and mental burden over just "put the contents of this element into a shadow for me", which is all you need and want for style isolation.

I hear you but we need a list of concrete use cases that support this argument.

> Avoiding additional unnecessary steps, even if they're objectively relatively simple, is the whole point of this entire exercise! A (complex) one-liner script that you copy-paste around is still, as we've seen, too much additional complexity for what people feel _should_ be a simple operation.
> 
> > Are there benefits in having declarative shadow DOM in the browser beyond perf & not requiring scripts? If so, what are they? And what concrete use cases would that serve?
> 
> Ergonomics is the biggest thing. If we want these things to be used by more authors, making them easy and simple to reach for, and more importantly, _natural_ to reach for, rather than looking like an advanced hack for complicated use-cases only, is extremely important. An attribute or a wrapper element right at the point you want isolation to happen feels simple and more or less like normal HTML. A script that does some stuff and moves elements around does not.

Ditto.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/831#issuecomment-599176016

Received on Sunday, 15 March 2020 07:07:14 UTC