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

> That's a fully general counter-argument against any addition to HTML at all, and so can't really be used as a specific objection without more details.

Yeah that's fair - I'll go into specific details and whether tradeoffs are worthwhile.

> That's just... DOM, right? Like, normal ordinary DOM children.

What I meant by this was declarative way to present the resultant composed tree after shadow root is attached and light DOM nodes are distributed - apologies if I'm getting the terminology wrong here.

More concretely, what I was thinking was a `composed` flag to tell the parser to pull a part this elements DOM into Shadow and Light DOMs.

```html
<div composed>
  Hello <slot><strong>World</strong></slot>
</div>
```

which the parser would turn into:

```html
<div>
  #shadow-root
    Hello <slot></slot>
<strong>World</strong>
</div>
```

This wouldn't be a 1:1 declarative version of imperative Shadow DOM API, just a way to tell the parser to construct an element's Shadow and Light trees. Straight off - and I'm sure there's a lot more I'm not considering - downsides are:

- No support for undistributed light DOM nodes
- No support for default slot content
- Certainly a confusing look at declarative Shadow DOM

I realise this may be way off base, but I just wanted to throw it out there as an idea, incase supporting current bots is worth the tradeoffs. 

 



-- 
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-329328629

Received on Wednesday, 13 September 2017 23:47:34 UTC