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

I tend to agree domenic. I am not personally convinced of the need here, but I don't oppose it.

> > What happens to <shadow-root />? Does it get removed?

> I'd think it would just stay there, like template does. The shadow-attaching is a parse-time operation, it's a dead element afterwards.

If it would just stay there as a dead element, the memory usage would increase, doubled.

Suppose the following html, using declarative Shadow DOM via `<shadowroot>`,
```
<custom-a>
  <shadowroot>
    <slot></slot>
    <div></div>
  </shadowroot>
  <custom-b>
    <shadowroot>
      <slot></slot>
      <custom-c>
         <shadowroot>
            <slot></slot>
            <div></div>
         </shadowroot>
         <div></div>      
      </custom-c>
    </shadowroot>
  </custom-b>
</custom-b>
```
In this case, the composed tree which the rendering engine actually hold would be:
```
custom-a
  ::shadow-root
     slot
     div
  shadowroot
    slot
    div
  custom-b
    ::shadow-root
      slot
      custom-c
         ::shadow-root
            slot
            div
         shadowroot
            slot
            div
         div
    shadowroot
      slot
      custom-c
         shadowroot
            slot
            div
         div
```
I would prefer to remove `<shadowroot> element from the light tree after parsing, to save memory.


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

Received on Thursday, 14 September 2017 02:20:21 UTC