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

> I think this is an anti-pattern because we are defining a shadowroot on a standard element (like div, span, main, etc...) which if I remember it right, will not work.

Spec explicitly states which elements can accept a shadow root in the `attachShadow()` invocation steps here: https://dom.spec.whatwg.org/#dom-element-attachshadow.

> And if we use a custom-element, we really don't need to put a shadowroot element because there's already a template mechanism being used that defines the shadowDOM of that custom element. The only thing needed is some SSR library to render that shadowDOM into a shadowroot, and then append/prepend it.

Not always. A custom element may indeed only define behaviour, but no content. If it defines content, the templating mechanism is arbitrary. I think it would be fair to say that custom element authors, if using shadow DOM and in the possible presence of a declared shadow root, the author must only create a shadow root if one is not already provided. It's up to them to template accordingly, too.

Some of these possible conflicts are why I am proposing an alternative route: https://gist.github.com/treshugart/dafb15f613bb7664d451f582da512f63, even if it's unlikely to get consideration.

-- 
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/510#issuecomment-340954117

Received on Wednesday, 1 November 2017 01:39:48 UTC