Re: Goals for Shadow DOM review

On Thu, Feb 20, 2014 at 11:07 AM, Dimitri Glazkov <dglazkov@google.com>wrote:

>
>
>
> On Thu, Feb 20, 2014 at 10:52 AM, Domenic Denicola <
> domenic@domenicdenicola.com> wrote:
>
>> (This email summarizes some offline conversation I had with Alex, so we
>> can get more people involved. I'm also CCing people who I know have an
>> interest in this sort of thing.)
>>
>> It seems to me that the technical review of shadow DOM is already well
>> underway via implementers and implementer feedback. This has produced a
>> number of good results, e.g. Anne's attempts to formalize the "monkey
>> patching" they do of DOM algorithms. As such technical review of the spec
>> is probably well taken care of already.
>>
>> However, there's a lot of interesting stuff the TAG could advise, around
>> how well the shadow DOM fits into the platform, the platform's future, and
>> our general interest in a layering strategy. For example, can shadow DOM be
>> used to explain existing elements, like <video> or <input type="range">, in
>> terms of a lower-level primitive?
>>
>
Yes!


>
>> [...]
>>
>> Finally, another interesting aspect of how shadow DOM could help explain
>> the platform is in terms of CSS generated content. Could it give some real
>> life structure to ::before, ::after, etc.? Apparently this is tricky
>> because implementations typically make these pseudo-elements more
>> lightweight than a typical shadow element would be. But it is worth
>> exploring whether this is possible.
>>
>
> Elliott had done some explorations on how that could be done a while back.
> Not sure if he still have all that data paged in.
>

Implementations are not as light weight as you assume. Gecko/Webkit and
Blink all create a real Element behind the scenes for ::before and ::after.
There's no ShadowRoot there, but that's not too much overhead. When I
looked into this a while ago the biggest issue was that the generated
content ShadowRoot "floats upward" to always be the top most ShadowRoot
that looks sort of like:

<::before><content><::after>

and it always makes itself the youngest ShadowRoot. There's also some
quirks with styling and such, but that's easier to explain.

- E

Received on Thursday, 20 February 2014 19:22:51 UTC